Commit 6cbd7b56 authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Minor code style issues.

parent b20dab40
Pipeline #45330 passed with stages
in 24 minutes and 48 seconds
......@@ -18,7 +18,6 @@ import sys
import click
import asyncio
from concurrent.futures import ProcessPoolExecutor
from celery.task.control import revoke
from mongoengine import Q
from nomad import config, infrastructure, processing, utils
......@@ -30,6 +29,7 @@ from .main import cli
def proc():
pass
@proc.command(help='List processing tasks')
def ls():
infrastructure.setup_logging()
......@@ -44,6 +44,7 @@ def ls():
ls(processing.Calc.objects(query))
ls(processing.Upload.objects(query))
@proc.command(help='Stop all running processing')
@click.option('--calcs', is_flag=True, help='Only stop calculation processing')
@click.option('--kill', is_flag=True, help='Use the kill signal and force task failure')
......@@ -66,14 +67,14 @@ def stop_all(calcs: bool, kill: bool):
kwargs = {}
if kill:
kwargs.update(signal='SIGKILL')
revoke(proc.celery_task_id, terminate=True, **kwargs)
processing.app.control.revoke(proc.celery_task_id, terminate=True, **kwargs)
if kill:
logger.info(
'fail proc', celery_task_id=proc.celery_task_id, kill=kill,
**logger_kwargs)
proc.fail('process terminate via nomad cli')
proc.process_status=processing.PROCESS_COMPLETED
proc.process_status = processing.PROCESS_COMPLETED
proc.save()
query = Q(process_status=processing.PROCESS_RUNNING) | Q(tasks_status=processing.RUNNING)
......
Supports Markdown
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