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

Added a proc command to control proc task from cli. [skip ci]

parent 71abf60e
Pipeline #45314 skipped
......@@ -18,12 +18,53 @@ import sys
import click
import asyncio
from concurrent.futures import ProcessPoolExecutor
from celery.task.control import revoke
from nomad import config
from nomad import config, infrastructure, processing, utils
from .main import cli'Processing related functions')
def proc():
@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')
def stop_all(calcs: bool, kill: bool):
logger = utils.get_logger(__name__)
def stop_all(query):
for proc in query:
logger_kwargs = dict(upload_id=proc.upload_id)
if isinstance(proc, processing.Calc):
'send terminate celery task', celery_task_id=proc.celery_task_id,
kill=kill, **logger_kwargs)
kwargs = {}
if kill:
revoke(proc.celery_task_id, terminate=True, **kwargs)
if kill:
'fail proc', celery_task_id=proc.celery_task_id, kill=kill,
**logger_kwargs)'process terminate via nomad cli')
if not calcs:
@cli.command(help='Attempts to reset the nomad.')
def reset():
from .main import create_client
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