diff --git a/webservice/webservice.py b/webservice/webservice.py index ec97eeb24fe4cfe9bd160f92640666bd1cf47a20..494608fd7223efa1ce10ce873d3eeb0e03af3476 100644 --- a/webservice/webservice.py +++ b/webservice/webservice.py @@ -1087,11 +1087,18 @@ class ActionsServer: request_time ) await update_mdc_status(self.mdc, 'dark_request', rid, ret) - if report_path is None: + if len(report_path) == 0: logging.warning("Failed to identify report path for dark_request") else: - await update_darks_paths(self.mdc, rid, in_folder, - out_folder, report_path) + if len(report_path) > 1: + logging.warning( + "More than one report path is returned. " + "Updating myMDC with the first report path only." + ) + await update_darks_paths( + self.mdc, rid, in_folder, + out_folder, report_path[0] + ) # END of part to run after sending reply asyncio.ensure_future(_continue()) @@ -1162,7 +1169,9 @@ class ActionsServer: async def launch_jobs( self, run_nrs, rid, detectors, action, instrument, cycle, proposal, request_time - ) -> (str, Optional[str]): + ) -> (str, List[str]): + report = [] + ret = [] # run xfel_calibrate for karabo_id, dconfig in detectors.items(): detector = dconfig['detector-type'] @@ -1179,16 +1188,16 @@ class ActionsServer: ).split() cmd = parse_config(cmd, dconfig) - - ret = await run_action(self.job_db, cmd, self.mode, - proposal, run_nrs[-1], rid) - + # TODO: Add detector info in returned run action status. + ret.append(await run_action( + self.job_db, cmd, self.mode, + proposal, run_nrs[-1], rid + )) if '--report-to' in cmd[:-1]: report_idx = cmd.index('--report-to') + 1 - report = cmd[report_idx] + '.pdf' - else: - report = None - return ret, report + report.append(cmd[report_idx] + '.pdf') + # return string without a tailing comma. + return ", ".join(ret), report parser = argparse.ArgumentParser( description='Start the calibration webservice')