|
| 1 | +Pipeline reporting |
| 2 | +================== |
| 3 | + |
| 4 | +This section describes how the reports of a FlowCraft pipeline are generated |
| 5 | +and collected at the end of a run. These reports can then be sent to the |
| 6 | +`FlowCraft web application <https://github.com/assemblerflow/flowcraft-webapp>`_ |
| 7 | +where the results are visualized. |
| 8 | + |
| 9 | +.. important:: |
| 10 | + Note that if the nextflow process reports add new types of data, one or |
| 11 | + more React components need to be added to the web application for them |
| 12 | + to be rendered. |
| 13 | + |
| 14 | +Data collection |
| 15 | +--------------- |
| 16 | + |
| 17 | +The data for the pipeline reports is collected from three dotfiles in each nextflow |
| 18 | +process (they should be present in each work sub directory): |
| 19 | + |
| 20 | +- **.report.json**: Contains report data (See :ref:`report-json` for more information). |
| 21 | +- **.versions**: Contains information about the versions of the software used |
| 22 | + (See :ref:`versions` for more information). |
| 23 | +- **.command.trace**: Contains resource usage information. |
| 24 | + |
| 25 | +The **.command.trace** file is generated by nextflow when the **trace** scope |
| 26 | +is active. The **.report.json** and **.version** files are specific to |
| 27 | +FlowCraft pipelines. |
| 28 | + |
| 29 | +Generation of dotfiles |
| 30 | +^^^^^^^^^^^^^^^^^^^^^^ |
| 31 | + |
| 32 | +Both **report.json** and **.versions** empty dotfiles are automatically generated |
| 33 | +by the ``{% include "post.txt" ignore missing %}`` placeholder, specified in the |
| 34 | +:ref:`create-process` section. Using this placeholder in your processes is all |
| 35 | +that is needed. |
| 36 | + |
| 37 | +Collection of dotfiles |
| 38 | +^^^^^^^^^^^^^^^^^^^^^^ |
| 39 | + |
| 40 | +The **.report.json**, **.versions** and **.command.trace** files are automatically |
| 41 | +collected and sent to dedicated report channels in the pipeline by the |
| 42 | +``{%- include "compiler_channels.txt" ignore missing -%}`` placeholder, specified |
| 43 | +in the :ref:`process creation <compiler>` section. Placing this placeholder in your |
| 44 | +processes will generate the following line in the output channel specification:: |
| 45 | + |
| 46 | + set {{ sample_id|default("sample_id") }}, val("{{ task_name }}_{{ pid }}"), val("{{ pid }}"), file(".report.json"), file(".versions"), file(".command.trace") into REPORT_{{task_name}}_{{ pid }} |
| 47 | + |
| 48 | +This line collects several metadata associated with the process along with the three |
| 49 | +dotfiles. |
| 50 | + |
| 51 | +Compilation of dotfiles |
| 52 | +^^^^^^^^^^^^^^^^^^^^^^^ |
| 53 | + |
| 54 | +As mentioned in the previous section, the dotfiles and other relevant metadata |
| 55 | +for are sent through special report channels to a FlowCraft component that is |
| 56 | +responsible for compiling all the information and generate a single report |
| 57 | +file at the end of each pipeline run. |
| 58 | + |
| 59 | +This component is specified in ``flowcraft.generator.templates.report_compiler.nf`` |
| 60 | +and it consists of two nextflow processes: |
| 61 | + |
| 62 | +- First, the **report** process receives the data from each executed process that |
| 63 | + sends report data and runs the ``flowcraft/bin/prepare_reports.py`` script |
| 64 | + on that data. This script will simply merge metadata and dotfiles information |
| 65 | + in a single JSON file. This file contains the following keys: |
| 66 | + |
| 67 | + - ``reportJson``: The data in **.report.json** file. |
| 68 | + - ``versions``: The data in **.versions** file. |
| 69 | + - ``trace``: The data in **.command.trace** file. |
| 70 | + - ``processId``: The process ID |
| 71 | + - ``pipelineId``: The pipeline ID that defaults to one, unless specified in |
| 72 | + the parameters. |
| 73 | + - ``projectid``: The project ID that defaults to one, unless specified in |
| 74 | + the parameters. |
| 75 | + - ``userId``: The user ID that defaults to one, unless specified in |
| 76 | + the parameters. |
| 77 | + - ``username``: The user name that defaults to *user*, unless specified in |
| 78 | + the parameters |
| 79 | + - ``processName``: The name of the flowcraft component. |
| 80 | + - ``workdir``: The work directory where the process was executed. |
| 81 | + |
| 82 | +- Second, all JSON files created in the process above are merged |
| 83 | + and a single reports JSON file is created. This file will contains the |
| 84 | + following structure:: |
| 85 | + |
| 86 | + reportJSON = { |
| 87 | + "data": { |
| 88 | + "results": [<array of report JSONs>] |
| 89 | + } |
| 90 | + } |
0 commit comments