Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleGoyette committed Feb 23, 2024
1 parent c1497c7 commit 553c12e
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Dockerfile.wandb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# syntax=docker/dockerfile:1.4

FROM python:3.9-slim
RUN apt update && apt install gcc -y

WORKDIR /launch

COPY --link requirements.txt ./
RUN pip install -r requirements.txt

COPY --link data_loader.py ./
RUN python data_loader.py # loads the keras data

COPY --link job.py configs/ ./
ENTRYPOINT ["python", "job.py"]
32 changes: 32 additions & 0 deletions runner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# runner.py - Place this in your current working directory

import sys
import importlib.util
import os

def run_script(script_path, args=[]):
# Backup the original sys.argv
original_argv = sys.argv

# Determine module name and path
module_name = os.path.basename(script_path).replace('.py', '')
spec = importlib.util.spec_from_file_location(module_name, script_path)
module = importlib.util.module_from_spec(spec)

try:
# Mimic command line arguments
sys.argv = [script_path] + args

# Load and execute the module
spec.loader.exec_module(module)

# If the module has a main function, call it
if hasattr(module, 'main'):
module.main()
finally:
# Restore the original sys.argv
sys.argv = original_argv

if __name__ == "__main__":
# Pass all arguments except the first (the script name itself) to run_script
run_script('./jobs/fashion_mnist_train/job.py', sys.argv[1:])

0 comments on commit 553c12e

Please sign in to comment.