diff --git a/webservice/messages.py b/webservice/messages.py index cd15c814862ac24c3720c41a15886c5f4309944e..14c5c8eb10c85f7d50cf818b84367d72111841dd 100644 --- a/webservice/messages.py +++ b/webservice/messages.py @@ -22,5 +22,7 @@ class MDC: class Success: UPLOADED_CONFIG = "SUCCESS: Uploaded config for cycle {}, proposal {}" START_CORRECTION = "SUCCESS: Started correction: proposal {}, run {}" + START_CHAR = "SUCCESS: Started dark characterization: proposal {}, run {}" START_CORRECTION_SIM = "SUCCESS: Started simulated correction: proposal {}, run {}" + START_CHAR_SIM = "SUCCESS: Started dark characterization: proposal {}, run {}" QUEUED = "Queued proposal {}, run {} for offline calibration" diff --git a/webservice/serve_overview.yaml b/webservice/serve_overview.yaml index dea9536613ad3552f1fb75e50b6025e454f5da42..d9dd9c3671337f0530a5ac21ede68570de677b5f 100644 --- a/webservice/serve_overview.yaml +++ b/webservice/serve_overview.yaml @@ -53,4 +53,4 @@ server-config: web-service: job-db: ./webservice_jobs.sqlite - cal-config: /home/karnem/myscratch/calibration3/calibration_configurations/default.yaml + cal-config: /home/xcal/calibration_config/ diff --git a/webservice/webservice.py b/webservice/webservice.py index 9c438a46b41ce9d011d448131557cfa1ef9f893d..3c1457be996c30eca9cd4ec77bde969dcee054d7 100644 --- a/webservice/webservice.py +++ b/webservice/webservice.py @@ -89,9 +89,9 @@ async def upload_config(socket, config, yaml, instrument, cycle, proposal): :param instrument: instrument for which the update is for :param cycle: the facility cylce the update is for :param proposal: the proposal the update is for - + The YAML contents will be placed into a file at - + {config.local-path}/{cycle}/{proposal}.yaml If it exists it is overwritten and then the new version is pushed to @@ -336,7 +336,7 @@ async def copy_untouched_files(file_list, out_folder, run): async def run_correction(conn, cmd, mode, proposal, run, rid): """ Run a correction command - + :param cmd: to run, should be a in list for as expected by subprocess.run :param mode: "prod" or "sim", in the latter case nothing will be executed but the command will be logged @@ -351,7 +351,10 @@ async def run_correction(conn, cmd, mode, proposal, run, rid): logging.info(" ".join(cmd)) ret = subprocess.run(cmd, stdout=subprocess.PIPE) if ret.returncode == 0: - logging.info(Success.START_CORRECTION.format(proposal, run)) + if "DARK" in cmd: + logging.info(Success.START_CHAR.format(proposal, run)) + else: + logging.info(Success.START_CORRECTION.format(proposal, run)) # enter jobs in job db c = conn.cursor() rstr = ret.stdout.decode() @@ -364,22 +367,32 @@ async def run_correction(conn, cmd, mode, proposal, run, rid): now=datetime.now().isoformat())) conn.commit() logging.debug(" ".join(cmd)) - return Success.START_CORRECTION.format(proposal, run) + if "DARK" in cmd: + return Success.START_CHAR.format(proposal, run) + else: + return Success.START_CORRECTION.format(proposal, run) else: logging.error(Errors.JOB_LAUNCH_FAILED.format(cmd, ret.returncode)) return Errors.JOB_LAUNCH_FAILED.format(cmd, ret.returncode) else: - logging.debug(Success.START_CORRECTION_SIM.format(proposal, run)) + if "DARK" in cmd: + logging.debug(Success.START_CHAR_SIM.format(proposal, run)) + else: + logging.debug(Success.START_CORRECTION_SIM.format(proposal, run)) + logging.debug(cmd) - return Success.START_CORRECTION_SIM.format(proposal, run) + if "DARK" in cmd: + return Success.START_CHAR_SIM.format(proposal, run) + else: + return Success.START_CORRECTION_SIM.format(proposal, run) async def server_runner(config, mode): """ The main server loop - + The main server loop handles remote requests via a ZMQ interface. - + Requests are the form of ZMQ.REQuest and have the format command, *parms