Skip to content

Commit

Permalink
Remove bad invariant from back when sensor status was a fixed status,…
Browse files Browse the repository at this point in the history
… not a default status (#6711)

* Remove bad invariant from back when sensor status was a fixed status, not a default status

Summary:
Plus add some missing test coverage for start_sensor when the default status is set to RUNNING in code, will do a similar pass for schedules separately now

* revert failing snapshot tests

Co-authored-by: prha <prha@elementl.com>
  • Loading branch information
gibsondan and prha committed Feb 18, 2022
1 parent b65900c commit fe61ba5
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions python_modules/dagster/dagster/core/instance/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1693,13 +1693,15 @@ def start_sensor(self, external_sensor):
)
from dagster.core.definitions.run_request import InstigatorType

check.invariant(
not external_sensor.default_status,
"Can only manually start a sensor that does not have its status set in code",
)

state = self.get_instigator_state(external_sensor.get_external_origin_id())

if external_sensor.get_current_instigator_state(state).is_running:
raise Exception(
"You have attempted to start sensor {name}, but it is already running".format(
name=external_sensor.name
)
)

if not state:
return self.add_instigator_state(
InstigatorState(
Expand Down

0 comments on commit fe61ba5

Please sign in to comment.