diff --git a/docs/exercise2.rst b/docs/exercise2.rst index b6f0bc5d209cd4d3e5f7040e925a99d827dcdb0f..0535a1f53adc80c425ace16c0fe46a85b4d92601 100644 --- a/docs/exercise2.rst +++ b/docs/exercise2.rst @@ -2,17 +2,30 @@ Exercise 2: Managing data flow ============================== 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 ----------- 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/problems/recruiting-script.py** is implemented as a workflow. Check -the workflow, add it to LaunchPad and run it in singleshot mode watching the -changes in the fireworks with the workflow run. +**exercises/inputs/2_data_flow/template.[json|yaml]** and complete it so that +the script **exercises/problems/recruiting-script.py** is implemented as a +workflow. Check the workflow, add it to LaunchPad and run it in singleshot mode +watching the changes in the fireworks with the workflow run. Problem 2.2 diff --git a/exercises/problems/5_author_firetask/dataloader+repeater.json b/exercises/problems/5_author_firetask/dataloader+repeater.json index ced47ecfa33621096d097540d65b9975931f5702..338294781fae54db50f1126c80e8df8498c8fd0e 100644 --- a/exercises/problems/5_author_firetask/dataloader+repeater.json +++ b/exercises/problems/5_author_firetask/dataloader+repeater.json @@ -32,11 +32,11 @@ { "_fw_name": "{{custom_tasks.RepeatIfLengthLesser}}", "measure": "applicant profiles", - "minimum": "number to apply" + "minimum": "number to screen" } ], "maximum applications": 30, - "number to apply": 10 + "number to screen": 10 } }, { diff --git a/exercises/problems/5_author_firetask/parameters.json b/exercises/problems/5_author_firetask/parameters.json index 59ad4a87ca533a8d01e73d46067357b4ce021b14..4f60c473cde57a8ea5f729e7f095f50be8b933f7 100644 --- a/exercises/problems/5_author_firetask/parameters.json +++ b/exercises/problems/5_author_firetask/parameters.json @@ -1,5 +1,5 @@ { - "number to apply": 10, + "number to screen": 10, "number to invite": 4, "number to fill": 2, "minimum score": 2, diff --git a/exercises/problems/5_author_firetask/recruiting-script.py b/exercises/problems/5_author_firetask/recruiting-script.py index 73c6153e11164221edf15b2ddcbd8896d2753013..469436c589f33553b89e12f4ed7b7e3242fa9f78 100644 --- a/exercises/problems/5_author_firetask/recruiting-script.py +++ b/exercises/problems/5_author_firetask/recruiting-script.py @@ -6,14 +6,14 @@ with open('parameters.json', 'r') as inp: template = parameters['application template'] job = parameters['job description'] -number_to_invite = parameters['number to invite'] max_to_apply = parameters['maximum applications'] 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_apply = parameters['number to apply'] applied = [] -while len(applied) < number_to_apply: +while len(applied) < number_to_screen: applied = candidates_apply(template, max_to_apply) screened = []