Skip to content
Snippets Groups Projects
Commit d1d4b88e authored by Ivan Kondov's avatar Ivan Kondov
Browse files
parents 718d86c5 97191319
No related branches found
No related tags found
No related merge requests found
...@@ -2,17 +2,30 @@ Exercise 2: Managing data flow ...@@ -2,17 +2,30 @@ Exercise 2: Managing data flow
============================== ==============================
The purpose of this exercise is to learn how to pass data between fireworks and The purpose of this exercise is to learn how to pass data between fireworks and
describe data dependencies using the custom firetask ``PythonFunctionTask``. describe data dependencies using the custom firetask ``PythonFunctionTask``::
- _fw_name: PythonFunctionTask
function: any_module.any_function
inputs:
- first argument
- second argument
outputs:
- data to forward
The keys specified in the ``inputs`` list must be available in the firework
``spec`` at task run time. These are passed as positional arguments to the
function. The returned outputs will be stored in the specs of the current firework
and of the child fireworks under the keys specified in the ``outputs`` list.
Problem 2.1 Problem 2.1
----------- -----------
Change to folder **exercises/work/2_data_flow**. Copy the provided template Change to folder **exercises/work/2_data_flow**. Copy the provided template
**exercises/inputs/2_data_flow/template.json** and complete it so that the script **exercises/inputs/2_data_flow/template.[json|yaml]** and complete it so that
**exercises/problems/recruiting-script.py** is implemented as a workflow. Check the script **exercises/problems/recruiting-script.py** is implemented as a
the workflow, add it to LaunchPad and run it in singleshot mode watching the workflow. Check the workflow, add it to LaunchPad and run it in singleshot mode
changes in the fireworks with the workflow run. watching the changes in the fireworks with the workflow run.
Problem 2.2 Problem 2.2
......
...@@ -32,11 +32,11 @@ ...@@ -32,11 +32,11 @@
{ {
"_fw_name": "{{custom_tasks.RepeatIfLengthLesser}}", "_fw_name": "{{custom_tasks.RepeatIfLengthLesser}}",
"measure": "applicant profiles", "measure": "applicant profiles",
"minimum": "number to apply" "minimum": "number to screen"
} }
], ],
"maximum applications": 30, "maximum applications": 30,
"number to apply": 10 "number to screen": 10
} }
}, },
{ {
......
{ {
"number to apply": 10, "number to screen": 10,
"number to invite": 4, "number to invite": 4,
"number to fill": 2, "number to fill": 2,
"minimum score": 2, "minimum score": 2,
......
...@@ -6,14 +6,14 @@ with open('parameters.json', 'r') as inp: ...@@ -6,14 +6,14 @@ with open('parameters.json', 'r') as inp:
template = parameters['application template'] template = parameters['application template']
job = parameters['job description'] job = parameters['job description']
number_to_invite = parameters['number to invite']
max_to_apply = parameters['maximum applications'] max_to_apply = parameters['maximum applications']
min_score = parameters['minimum score'] min_score = parameters['minimum score']
number_to_invite = parameters['number to invite']
number_to_screen = parameters['number to screen']
number_to_fill = parameters['number to fill'] number_to_fill = parameters['number to fill']
number_to_apply = parameters['number to apply']
applied = [] applied = []
while len(applied) < number_to_apply: while len(applied) < number_to_screen:
applied = candidates_apply(template, max_to_apply) applied = candidates_apply(template, max_to_apply)
screened = [] screened = []
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment