Commit c7224e50 authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Added a parameter to reprocessing running processes.

parent 7b395ae1
Pipeline #71898 passed with stages
in 13 minutes and 20 seconds
......@@ -40,7 +40,8 @@ from nomad.normalizing.springer import update_springer_data
def __run_processing(
uploads, parallel: int, process: Callable[[proc.Upload], None], label: str):
uploads, parallel: int, process: Callable[[proc.Upload], None], label: str,
reprocess_running: bool = False):
if isinstance(uploads, (tuple, list)):
uploads_count = len(uploads)
......@@ -64,7 +65,7 @@ def __run_processing(
logger.info('%s started' % label, upload_id=upload.upload_id)
completed = False
if upload.process_running:
if upload.process_running and not reprocess_running:
logger.warn(
'cannot trigger %s, since the upload is already/still processing' % label,
current_process=upload.current_process,
......
......@@ -272,10 +272,13 @@ def msgpack(ctx, uploads):
@uploads.command(help='Reprocess selected uploads.')
@click.argument('UPLOADS', nargs=-1)
@click.option('--parallel', default=1, type=int, help='Use the given amount of parallel processes. Default is 1.')
@click.option('--reprocess-running', is_flag=True, help='Also reprocess already running processes.')
@click.pass_context
def re_process(ctx, uploads, parallel: int):
def re_process(ctx, uploads, parallel: int, reprocess_running: bool):
_, uploads = query_uploads(ctx, uploads)
__run_processing(uploads, parallel, lambda upload: upload.re_process_upload(), 're-processing')
__run_processing(
uploads, parallel, lambda upload: upload.re_process_upload(), 're-processing',
reprocess_running=reprocess_running)
@uploads.command(help='Repack selected uploads.')
......
......@@ -98,8 +98,10 @@ class Calc(Proc):
('upload_id', 'process_status'),
('upload_id', 'metadata.nomad_version'),
'parser',
'metadata.processed',
'metadata.last_processing',
'metadata.published',
'metadata.datasets'
'metadata.datasets',
'metadata.pid'
]
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment