Exemplo n.º 1
0
def execution_terminate(scheduler: ZoeBaseScheduler, execution: Execution,
                        reason: str):
    """Remove an execution from the scheduler."""
    if execution.is_running or execution.status == execution.QUEUED_STATUS:
        execution.set_cleaning_up()
        execution.set_error_message(reason)
        scheduler.terminate(execution)
    elif execution.status == execution.CLEANING_UP_STATUS:
        scheduler.terminate(execution)
    elif execution.status == execution.SUBMIT_STATUS:
        execution.set_terminated(reason)
    elif execution.status == execution.STARTING_STATUS:
        return  # It is unsafe to terminate executions in these statuses
    elif execution.status == execution.ERROR_STATUS:
        terminate_execution(execution, reason)
    elif execution.status == execution.TERMINATED_STATUS:
        return
Exemplo n.º 2
0
def terminate_execution(execution: Execution) -> None:
    """Terminate an execution."""
    for service in execution.services:  # type: Service
        terminate_service(service)
    execution.set_terminated()
Exemplo n.º 3
0
def terminate_execution(execution: Execution,
                        reason: Union[None, str] = None) -> None:
    """Terminate an execution."""
    for service in execution.services:  # type: Service
        terminate_service(service)
    execution.set_terminated(reason)