Skip to content

Commit

Permalink
demonstrate another part
Browse files Browse the repository at this point in the history
  • Loading branch information
ahnitz committed Dec 6, 2023
1 parent 8214edc commit 8bb6095
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion examples/workflow/quickstart/option_exe
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ import argparse, shutil
parser = argparse.ArgumentParser()
parser.add_argument('--input-file')
parser.add_argument('--output-file')
parser.add_argument("--append-count", type=int, default=1)
parser.add_argument('--append-text', help='append this text to output file')
args = parser.parse_args()

shutil.copyfile(args.input_file, args.output_file)

if args.append_text:
with open(args.output_file, 'a') as f:
f.write(args.append_text)
for i in range(args.append_count):
f.write(args.append_text)
8 changes: 6 additions & 2 deletions examples/workflow/quickstart/simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# override parameters, or to choose if to plan or directly submit
# the workflow
parser = argparse.ArgumentParser(description=__doc__[1:])
parser.add_argument('--verbose')
parser.add_argument('--verbose', action='count')
wf.add_workflow_command_line_group(parser)
wf.add_workflow_settings_cli(parser)
args = parser.parse_args()
Expand Down Expand Up @@ -48,7 +48,8 @@

# Create a file handle for the future *output* of this job. Every file in
# a workflow must have a unique name. This also demonstrates making
# explicit file names.
# explicit file names and an explicit output folder. Typically,
# you may want to let the workflow decide these locations / names
out1 = wf.File.from_path(os.path.abspath("test_output.txt"))

# add the output file as the second argument of the executable
Expand All @@ -70,6 +71,9 @@
# job in the workflow. This will automatically have the previous job
# run first and then pass the file it creates along to the later job.
node2.add_input_opt('--input-file', out1)

# add an option with value
node2.add_opt('--append-count', str(i))

# add the output file as the second argument of the executable
# The filename must be unique and is built from the executable name
Expand Down

0 comments on commit 8bb6095

Please sign in to comment.