Felipe Saldana
04/12/2021, 11:36 PMRun a flow that is registered to the Prefect API
Options:
--id, -i TEXT The ID of a flow to run
--version-group-id TEXT The ID of a flow version group to run
--name, -n TEXT The name of a flow to run
--project, -p TEXT The name of a project that contains the flow
--version, -v INTEGER A flow version to run
--parameters-file, -pf FILE PATH A filepath of a JSON file containing
parameters
--parameters-string, -ps TEXT A string of JSON parameters (note: to ensure these are
parsed correctly, it is best to include the full payload
within single quotes)
Kevin Kho
04/13/2021, 2:31 AMmutation SetDefaultParams($input: set_flow_group_default_parameters_input!){
set_flow_group_default_parameters(input: $input) {
success
error
}
}
$input
looks like:
input: {
flow_group_id: uuid!,
parameters: jsonb
}
Felipe Saldana
04/13/2021, 2:40 PMKevin Kho
05/28/2021, 2:37 PMFelipe Saldana
05/28/2021, 2:46 PMKevin Kho
05/28/2021, 2:52 PMFelipe Saldana
05/28/2021, 8:40 PMinput: {
flow_group_id: uuid!,
parameters: jsonb
}
Kevin Kho
05/28/2021, 8:56 PM"{\"foo\": 2}"
Felipe Saldana
05/28/2021, 9:01 PMKevin Kho
05/28/2021, 9:11 PMFelipe Saldana
06/02/2021, 12:01 AMmutation {
set_flow_group_default_parameters(input: {
flow_group_id: "fe8d69d6-f3c1-4d49-bfcd-7faca514a283",
parameters: {mapped_run_name: ["DEV_push1"]}
}) {
success
error
}
}
Kevin Kho
06/02/2021, 12:03 AMFelipe Saldana
06/02/2021, 12:04 AMKevin Kho
06/02/2021, 1:05 AMmutation {
set_flow_group_default_parameters(input: {
flow_group_id: "d412b313-3776-4682-867f-4d89c0679e4f",
parameters: "{\"mapped_run_name\": [\"DEV_push1\"]}"
}) {
success
error
}
}
Felipe Saldana
06/02/2021, 1:12 AMException has occurred: ClientError
400 Client Error: Bad Request for url: <https://api.prefect.io/graphql>
The following error messages were provided by the GraphQL server:
GRAPHQL_PARSE_FAILED: Syntax Error: Expected :, found String ": ["
The GraphQL query was:
mutation {
set_flow_group_default_parameters(input: {
flow_group_id: "fe8d69d6-f3c1-4d49-bfcd-7faca514a283",
parameters: "{"mapped_run_name": ["DEV_push1"]}"
}) {
success
error
}
}
The passed variables were:
null
The above exception was the direct cause of the following exception:
File "/workspaces/prism.etl.prefect-flows.db-ingest/db_ingest/flows/ENVERUS_DATA_INTEL_PUSH_FRONTEND/test_graphql.py", line 139, in <module>
ret_val = client.graphql(update_query)
Kevin Kho
06/02/2021, 1:13 AMFelipe Saldana
06/02/2021, 1:13 AMclient.graphql(update_query)
Kevin Kho
06/02/2021, 1:14 AMFelipe Saldana
06/02/2021, 1:14 AMKevin Kho
06/02/2021, 1:28 AMfrom prefect.client.client import Client
import json
client = Client()
query = """
mutation($params: JSON!) {
set_flow_group_default_parameters(input: {
flow_group_id: "d412b313-3776-4682-867f-4d89c0679e4f",
parameters: $params
}) {
success
error
}
}
"""
params = {
"mapped_run_name": ["DEV_push1"],
}
client.graphql(query, variables={"params":params})
Felipe Saldana
06/02/2021, 1:36 AM{'data': {'flow': [{'id': 'fe8d69d6-f3c1-4d49-bfcd-7faca514a283'}]}}
{'data': {'set_flow_group_default_parameters': {'success': False, 'error': None}}}
Kevin Kho
06/02/2021, 1:58 AMFelipe Saldana
06/03/2021, 10:50 PMnicholas
06/03/2021, 11:06 PMFelipe Saldana
06/03/2021, 11:11 PMquery = """
mutation($flow_group_id: UUID!,$cron_clocks: String!, $params: JSON!) {
set_flow_group_schedule(input :{
flow_group_id: $flow_group_id,
cron_clocks: [{cron: $cron_clocks, parameter_defaults: $params}],
timezone: "UTC"
}) {
success
error
}
}
"""
nicholas
06/03/2021, 11:12 PMFelipe Saldana
06/03/2021, 11:13 PM