Ejemplo n.º 1
0
 def test_running_state(self):
     ti = Mock(state=State.RUNNING, end_date=datetime(2016, 1, 1))
     assert not TaskNotRunningDep().is_met(ti=ti)
Ejemplo n.º 2
0
BACKFILL_QUEUEABLE_STATES = {
    # For cases like unit tests and run manually
    State.NONE,
    State.UP_FOR_RESCHEDULE,
    State.UP_FOR_RETRY,
    # For normal backfill cases
    State.SCHEDULED,
}

# Context to get the dependencies that need to be met in order for a task instance to be
# set to 'scheduled' state.
SCHEDULED_DEPS = {
    RunnableExecDateDep(),
    ValidStateDep(SCHEDULEABLE_STATES),
    TaskNotRunningDep(),
}

# Dependencies that if met, task instance should be re-queued.
REQUEUEABLE_DEPS = {
    DagTISlotsAvailableDep(),
    TaskConcurrencyDep(),
    PoolSlotsAvailableDep(),
}

# Dependencies that need to be met for a given task instance to be set to 'RUNNING' state.
RUNNING_DEPS = {
    RunnableExecDateDep(),
    ValidStateDep(RUNNABLE_STATES),
    DagTISlotsAvailableDep(),
    TaskConcurrencyDep(),
Ejemplo n.º 3
0
 def test_not_running_state(self):
     ti = Mock(state=State.QUEUED, end_date=datetime(2016, 1, 1))
     self.assertTrue(TaskNotRunningDep().is_met(ti=ti))