Microsoft Graph API Sensors

MSGraphSensor

Use the MSGraphSensor to poll a Power BI API.

Below is an example of using this sensor to poll the status of a PowerBI workspace.

tests/system/microsoft/azure/example_powerbi.py[source]

    check_workspace_status_task = MSGraphSensor.partial(
        task_id="check_workspaces_status",
        conn_id="powerbi_api",
        url="myorg/admin/workspaces/scanStatus/{scanId}",
        timeout=350.0,
    ).expand(path_parameters=workspaces_info_task.output)

Starting from the triggerer

With start_from_trigger=True the scheduler defers the sensor itself, so the first poll is done without a worker being involved. The timeout of the sensor counts from the moment the scheduler deferred the sensor, so it covers that first poll and the ones after it. The requirements and limitations are the same as for the operator, see Starting from the triggerer.

check_workspace_status_task = MSGraphSensor(
    task_id="check_workspaces_status",
    conn_id="powerbi",
    url="myorg/admin/workspaces/scanStatus/{scanId}",
    path_parameters={"scanId": "{{ params.scan_id }}"},
    start_from_trigger=True,
)

Reference

For further information, look at:

Was this entry helpful?