Page MenuHomeElementl

[docs] Expand section on testing sensors
ClosedPublic

Authored by cdecarolis on May 24 2021, 7:26 PM.

Details

Summary

This diff expands on the sensors testing section

Test Plan

docs build, unit

Screen Shot 2021-05-25 at 1.42.27 PM.png (495×938 px, 44 KB)

Screen Shot 2021-05-24 at 3.23.55 PM.png (649×884 px, 110 KB)

Diff Detail

Repository
R1 dagster
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

examples/docs_snippets/docs_snippets/concepts/partitions_schedules_sensors/sensors/sensors.py
55

seems like instance_for_test comes from nowhere. should we either include import instance_for_test inside the code snippet or switch to use another func to build an ephemeral instance?

sandyryza added inline comments.
docs/content/concepts/partitions-schedules-sensors/sensors.mdx
198

Given that the sensor doesn't use the instance, it seems like unnecessary boilerplate to need to define an instance here. Are we able to not require that?

This revision now requires changes to proceed.May 24 2021, 9:55 PM
examples/docs_snippets/docs_snippets/concepts/partitions_schedules_sensors/sensors/sensors.py
55

Good point. I think sensors/schedules require persistent instances, but maybe making an example that doesn't use the instance at all will let us get away with not using one.

examples/docs_snippets/docs_snippets/concepts/partitions_schedules_sensors/sensors/sensors.py
56

Does this work on master? I believe that, with Phil's recent addition of sensor cursors,get_execution_data now returns a SensorExecutionData, which I don't believe is iterable.

examples/docs_snippets/docs_snippets/concepts/partitions_schedules_sensors/sensors/sensors.py
56

yes, hence the requests.run_requests. A better variable name would probably help here, like execution_data.run_requests.

Add get_execution_data to api ref, update overview to reflect this

cdecarolis added a reviewer: prha.
python_modules/dagster/dagster/core/definitions/sensor.py
284

we should add an args entry for cursor

python_modules/dagster/dagster/core/definitions/sensor.py
284

ah good catch, thanks

get_execution_data -> evaluate_tick

This revision is now accepted and ready to land.May 26 2021, 8:27 PM