Skip to content
Snippets Groups Projects
Commit 5a5d2ac1 authored by Karim Ahmed's avatar Karim Ahmed
Browse files

extend submission output messages

parent a5a6f749
No related branches found
No related tags found
1 merge request!93feat/reportservice
import argparse import argparse
import asyncio import asyncio
from asyncio.subprocess import PIPE, STDOUT from asyncio.subprocess import PIPE
import copy import copy
import getpass import getpass
import glob import glob
...@@ -38,6 +38,7 @@ def init_config_repo(config): ...@@ -38,6 +38,7 @@ def init_config_repo(config):
# clone the repo. # clone the repo.
repo = Repo.clone_from(config['figures-remote'], repo = Repo.clone_from(config['figures-remote'],
config['repo-local']) config['repo-local'])
logging.info("Clonning the repository")
# make sure it is updated # make sure it is updated
repo.remote().pull() repo.remote().pull()
logging.info("Config repo is initialized") logging.info("Config repo is initialized")
...@@ -201,7 +202,7 @@ async def server_runner(conf_file, jobs_timeout): ...@@ -201,7 +202,7 @@ async def server_runner(conf_file, jobs_timeout):
logging.info('Requested Configuration: {}'.format(req_cfg)) 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') logging.info('Run plot production')
all_new_files = [] all_new_files = []
...@@ -226,21 +227,28 @@ async def server_runner(conf_file, jobs_timeout): ...@@ -226,21 +227,28 @@ async def server_runner(conf_file, jobs_timeout):
try: try:
output = await asyncio.create_subprocess_shell( output = await asyncio.create_subprocess_shell(
" ".join(run_base), stdout=PIPE, stderr=PIPE) " ".join(run_base), stdout=PIPE, stderr=PIPE)
launched_jobs.append(output.communicate()) launched_jobs.append(output.communicate())
logging.info('Submission information: {}' logging.info('Submission information: {}:'
.format(run_base)) .format(run_base))
except Exception as e: except Exception as e:
logging.error('Submission failed: {}'.format(e)) logging.error('Submission failed: {}'.format(e))
exit(1) exit(1)
outputs = await asyncio.gather(*launched_jobs) outputs = await asyncio.gather(*launched_jobs)
job_list = [] job_list = []
for output in outputs: 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')) job_list += await parse_output(output[0].decode('utf8'))
try: try:
# make sure to timeout if waiting for jobs # make sure to timeout if waiting for jobs
# took more than 10 mins. # took more than 10 mins.
...@@ -283,8 +291,8 @@ async def server_runner(conf_file, jobs_timeout): ...@@ -283,8 +291,8 @@ async def server_runner(conf_file, jobs_timeout):
asyncio.ensure_future( asyncio.ensure_future(
push_figures(cfg['GLOBAL']['git']['repo-local'], push_figures(cfg['GLOBAL']['git']['repo-local'],
all_new_files)) all_new_files))
# TODO:delete out-folder
#try: #try:
# TODO:delete out-folder
# asyncio.ensure_future(del_folder(out_folder)) # asyncio.ensure_future(del_folder(out_folder))
#except: #except:
#logging.error(str(e)) #logging.error(str(e))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment