Skip to content

prefect_census.flows

Prefect flows for interacting with Census.

Classes

Functions

run_census_sync async

A flow for triggering a Census sync run and waiting for completion.

Parameters:

Name Type Description Default
census_sync CensusSync

The Census sync job block to trigger.

required

Returns:

Type Description

The result of the sync run.

Source code in prefect_census/flows.py
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
@flow
async def run_census_sync(census_sync: CensusSync):
    """A flow for triggering a Census sync run and waiting for completion.

    Args:
        census_sync: The Census sync job block to trigger.

    Returns:
        The result of the sync run.
    """
    census_sync_run = await task(census_sync.trigger.aio)(census_sync)

    sync_status = await task(census_sync_run.wait_for_completion.aio)(census_sync_run)

    return await task(census_sync_run.fetch_result.aio)(
        census_sync_run, wait_for=[sync_status]
    )