From 5a5d2ac15e0d63adcaa0dafaf07ad5acc0d4e7f5 Mon Sep 17 00:00:00 2001 From: Karim Ahmed <karim.ahmed@xfel.eu> Date: Wed, 17 Jul 2019 17:00:36 +0200 Subject: [PATCH] extend submission output messages --- reportservice/report_service.py | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/reportservice/report_service.py b/reportservice/report_service.py index 24cd8e297..88bd8de70 100644 --- a/reportservice/report_service.py +++ b/reportservice/report_service.py @@ -1,6 +1,6 @@ import argparse import asyncio -from asyncio.subprocess import PIPE, STDOUT +from asyncio.subprocess import PIPE import copy import getpass import glob @@ -38,6 +38,7 @@ def init_config_repo(config): # clone the repo. repo = Repo.clone_from(config['figures-remote'], config['repo-local']) + logging.info("Clonning the repository") # make sure it is updated repo.remote().pull() logging.info("Config repo is initialized") @@ -201,7 +202,7 @@ async def server_runner(conf_file, jobs_timeout): logging.info('Requested Configuration: {}'.format(req_cfg)) - async def do_action(cfg, jobs_timeout = 3000): + async def do_action(cfg, jobs_timeout=3000): logging.info('Run plot production') all_new_files = [] @@ -226,21 +227,28 @@ async def server_runner(conf_file, jobs_timeout): try: output = await asyncio.create_subprocess_shell( " ".join(run_base), stdout=PIPE, stderr=PIPE) - + launched_jobs.append(output.communicate()) - logging.info('Submission information: {}' - .format(run_base)) + logging.info('Submission information: {}:' + .format(run_base)) except Exception as e: logging.error('Submission failed: {}'.format(e)) exit(1) + outputs = await asyncio.gather(*launched_jobs) job_list = [] - for output in outputs: + if output[0]: + logging.info('Submission Output: {}' + .format(output[0].decode('utf8'))) + if output[1]: + logging.error('Submission Error: {}' + .format(output[1].decode('utf8'))) job_list += await parse_output(output[0].decode('utf8')) + try: # make sure to timeout if waiting for jobs # took more than 10 mins. @@ -283,8 +291,8 @@ async def server_runner(conf_file, jobs_timeout): asyncio.ensure_future( push_figures(cfg['GLOBAL']['git']['repo-local'], all_new_files)) + # TODO:delete out-folder #try: - # TODO:delete out-folder # asyncio.ensure_future(del_folder(out_folder)) #except: #logging.error(str(e)) -- GitLab