def handle_run_created(workers_backend, event: "Event") -> None: # noqa: F821 """Handles creation, resume, and restart""" eager = False if (event.instance and event.instance.status != V1Statuses.RESUMING and (event.instance.meta_info or {}).get(META_EAGER_MODE)): eager = True if not eager: eager = (not event.data["is_managed"] and event.instance and event.instance.content) # Run is not managed by Polyaxon if not event.data["is_managed"] and not eager: return # Run is managed by a pipeline if event.data.get("pipeline_id") is not None: return if conf.get(SCHEDULER_ENABLED) and not eager: workers_backend.send(CoreSchedulerCeleryTasks.RUNS_PREPARE, kwargs={"run_id": event.instance_id}) return # Eager mode manager.runs_prepare(run_id=event.instance_id, run=event.instance, eager=True)
def handle_run_created(workers_backend, event: "Event") -> None: # noqa: F821 """Handles creation, resume, and restart""" # Run is not managed by Polyaxon if not event.data["is_managed"]: return # Run is managed by a pipeline if event.data.get("pipeline_id") is not None: return if conf.get(SCHEDULER_ENABLED): workers_backend.send(CoreSchedulerCeleryTasks.RUNS_PREPARE, kwargs={"run_id": event.instance_id}) return # Eager mode manager.runs_prepare(run_id=event.instance_id, run=event.instance, eager=True)
def runs_prepare(run_id): if manager.runs_prepare(run_id=run_id, run=None): workers.send(CoreSchedulerCeleryTasks.RUNS_START, kwargs={"run_id": run_id})