def __init__(self, *args, **kwargs): run = kwargs.pop("run", None) super(DatabandRunError, self).__init__(*args, **kwargs) if run is None: from dbnd import get_databand_run run = get_databand_run() self.run = run
def cancel_run(): print("Going to kill current run") databand_run = get_databand_run() r = databand_run.kill_run() print("Killed run") import time # Wait for task run to die time.sleep(5) return r