| 35 | |
| 36 | |
| 37 | class FlowcraftReport: |
| 38 | |
| 39 | def __init__(self, report_file, trace_file=None, log_file=None, |
| 40 | watch=False, ip_addr=None): |
| 41 | |
| 42 | self.report_file = report_file |
| 43 | """ |
| 44 | str: Path to Report JSON file. |
| 45 | """ |
| 46 | |
| 47 | if not ip_addr: |
| 48 | self.app_address = "http://www.flowcraft.live:80/" |
| 49 | else: |
| 50 | self.app_address = ip_addr |
| 51 | """ |
| 52 | str: Address of flowcraft web app |
| 53 | """ |
| 54 | |
| 55 | self.broadcast_address = "{}reports/broadcast/api/reports".format( |
| 56 | self.app_address) |
| 57 | |
| 58 | self.refresh_rate = 1 |
| 59 | |
| 60 | self.send = True |
| 61 | """ |
| 62 | boolean: This attribute is used when the report mode is used with the |
| 63 | --watch option. It will be set to False after sending a request, and |
| 64 | set to True when there is a change in the pipeline reports. |
| 65 | """ |
| 66 | |
| 67 | self.watch = watch |
| 68 | """ |
| 69 | boolean: When False, the reports mode will try to open the provided |
| 70 | report JSON file and send it to the flowcraft service. When True, |
| 71 | it will try to open the nextflow trace file instead and continuously |
| 72 | compile the report JSON files from the `report` processes as they |
| 73 | are created. |
| 74 | """ |
| 75 | |
| 76 | self.log_file = log_file |
| 77 | """ |
| 78 | str: Path to .nextflow.log file. |
| 79 | """ |
| 80 | |
| 81 | self.log_sizestamp = None |
| 82 | """ |
| 83 | str: Stores the sizestamp of the last modification of the trace file. |
| 84 | This is used to parse the file only when it has changed. |
| 85 | """ |
| 86 | |
| 87 | self.status_info = None |
| 88 | """ |
| 89 | str: Status of the pipeline execution. Used in the watch report mode |
| 90 | and varies between 'running', 'aborted', 'complete'. |
| 91 | """ |
| 92 | |
| 93 | self.trace_file = trace_file |
| 94 | """ |