Skip to content

Commit

Permalink
Checking sensor health
Browse files Browse the repository at this point in the history
  • Loading branch information
dpeng817 committed Jan 7, 2022
1 parent 4aa3d93 commit 350fe6d
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def basic():
the_job = basic.to_job(name="the_job")


@sensor(job=the_job, minimum_interval_seconds=1)
@sensor(job=the_job, minimum_interval_seconds=60)
def the_sensor():
yield RunRequest(run_key=None, run_config={})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,47 @@
}
}
"""
GET_SENSOR_QUERY = """
query SensorQuery($sensorSelector: SensorSelector!) {
sensorOrError(sensorSelector: $sensorSelector) {
__typename
... on PythonError {
message
stack
}
... on Sensor {
name
targets {
pipelineName
solidSelection
mode
}
minIntervalSeconds
nextTick {
timestamp
}
sensorState {
status
runs {
id
runId
}
runsCount
ticks {
id
status
timestamp
runIds
error {
message
stack
}
}
}
}
}
}
"""
RUNS_QUERY = """
query PipelineRunsRootQuery {
pipelineRunsOrError {
Expand Down Expand Up @@ -230,10 +271,18 @@ def test_sensor_run(graphql_client):
response = graphql_client._execute(RUNS_QUERY)
runs_list = response["pipelineRunsOrError"]["results"]

graphql_client._execute(
stop_sensor_response = graphql_client._execute(
STOP_SENSORS_QUERY, {"jobOriginId": start_sensor_response["startSensor"]["jobOriginId"]}
)

assert stop_sensor_response["stopSensor"]["instigationState"]["status"] == "STOPPED"

get_sensor_response = graphql_client._execute(
GET_SENSOR_QUERY, {"sensorSelector": sensor_selector}
)

get_sensor_response

response = graphql_client._execute(RUNS_QUERY)
runs_list = response["pipelineRunsOrError"]["results"]

Expand Down

0 comments on commit 350fe6d

Please sign in to comment.