Skip to content

Commit

Permalink
Add demo option
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-kotliar committed Jul 5, 2018
1 parent 7742132 commit fbca5c0
Show file tree
Hide file tree
Showing 11 changed files with 895 additions and 4 deletions.
5 changes: 4 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
include cwl_airflow/git_version
include cwl_airflow/git_version
include cwl_airflow/tests/cwl/*
include cwl_airflow/tests/data/*
include cwl_airflow/tests/job/*
20 changes: 19 additions & 1 deletion cwl_airflow/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
suppress_stdout()
# Suppress output
from airflow.bin.cli import scheduler
from cwl_airflow.utils.func import export_job_file, update_args, update_config, export_dags, create_folders
from cwl_airflow.utils.func import export_job_file, update_args, update_config, export_dags, create_folders, get_demo_workflow
from cwl_airflow.utils.utils import get_workflow_output, normalize_args, exit_if_unsupported_feature
# Restore output
restore_stdout()
Expand Down Expand Up @@ -36,9 +36,27 @@ def arg_parser():
run_parser.add_argument("workflow", type=str)
run_parser.add_argument("job", type=str)

demo_parser = subparsers.add_parser('demo', help="Run demo workflows", parents=[parent_parser])
demo_parser.set_defaults(func=run_demo)
demo_parser.add_argument("-o", "--outdir", dest='output_folder', type=str, help="Output directory, default current directory", default=".")
demo_parser.add_argument("-t", "--tmp", dest='tmp_folder', type=str, help="Folder to store temporary data")
demo_parser.add_argument("-u", "--uid", dest='uid', type=str, help="Unique ID", default=str(uuid.uuid4()))
demo_parser.add_argument("workflow", type=str)

return general_parser


def run_demo(args):
if not args.workflow:
print("Available workflows to run:")
for wf in get_demo_workflow():
print("-",wf["workflow"]["name"])
else:
selected_demo = get_demo_workflow(args.workflow)
args.workflow = selected_demo[0]["workflow"]["path"]
args.job = selected_demo[0]["job"]["path"]
run_job(args)

def run_init(args):
update_config(args)
create_folders()
Expand Down
Loading

0 comments on commit fbca5c0

Please sign in to comment.