Pypushflow api change to stop a workflow
import os
from time import sleep
from ewoksjob.client import submit
# Assume Bliss demo worker is running:
# BEACON_HOST=lindenolf:10001 CELERY_LOADER=ewoksjob.config.EwoksLoader \
# celery -A ewoksjob.apps.ewoks worker --pool=worker
os.environ["BEACON_HOST"] = "lindenolf:10001"
args = ("bes.flows.TroubleShooting",)
load_options = {"representation": "json_module", "root_module": "bes.flows"}
kwargs = {
"load_options": load_options,
"binding": "ppf",
"stop_on_signals": True, # stop workflow on SIGTERM send by celery
# as a result of calling future.revoke
"forced_interruption": True, # kill running tasks when stopping the workflow
}
future = submit(args=args, kwargs=kwargs)
sleep(0.5)
future.revoke(terminate=True)
future.get()
Edited by Wout De Nolf