Skip to content

prefect_monte_carlo.resources

Module defining tasks for interacting with Monte Carlo resources.

Classes

Functions

get_monte_carlo_resources async

Task to retrieve aggregate Monte Carlo resource information via the getResources GraphQL query. Fields selected by this query include: name, type, id, uuid, isDefault, and isUserProvided.

Parameters:

Name Type Description Default
monte_carlo_credentials MonteCarloCredentials

The Monte Carlo credentials block used to generate an authenticated GraphQL API client via pycarlo.

required
Source code in prefect_monte_carlo/resources.py
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
@task
async def get_monte_carlo_resources(
    monte_carlo_credentials: MonteCarloCredentials,
) -> box.BoxList:
    """
    Task to retrieve aggregate Monte Carlo resource information via the `getResources`
    GraphQL query. Fields selected by this query include: `name`, `type`, `id`, `uuid`,
    `isDefault`, and `isUserProvided`.

    Args:
        monte_carlo_credentials: The Monte Carlo credentials block used to generate
            an authenticated GraphQL API client via pycarlo.
    Returns:
        A `box.BoxList` of Monte Carlo resources.
    """

    client = monte_carlo_credentials.get_client()
    query = """
        query {
            getResources {
                name
                type
                id
                uuid
                isDefault
                isUserProvided
            }
        }
    """
    return client(query)