-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c1497c7
commit 553c12e
Showing
2 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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:]) |