Ben Sack
09/10/2021, 3:00 PMflow_runs
by parameter by using something like: flow_runs(where:{parameters: {_has_key: "process_date"}}
but what I would like to do is filter the query for any flows that ran on a specific process date, such as, 8/17/2021, rather than filtering for flows that have the process_date
parameter. Thanks!Kevin Kho
Ben Sack
09/13/2021, 8:32 PMKevin Kho
Ben Sack
09/16/2021, 8:52 PM"parameters": {}
, yet when I check in the parameters section for the flow_runs in the Perfect UI you can plainly see that there are parameters. Any ideas on why this would be? I can provide my query and results if that would help better understand the issue. ThanksKevin Kho
default_parameters
. parameters
are the ones explicitly supplied, but there is a default_parameter
in the flow or flow run where you are probably passing the parameters through. Does that make sense for you?Ben Sack
09/17/2021, 3:11 PMdefault_parameters
but that didn’t seem to do the trick either since that is a filter for the flow_group
rather than flow_run
. Here is the query I’m running and a snippet of the Prefect UI so you can better see what I’m struggling with.
Query:
{
flow(
where: {_and: [{name: {_eq: "snowflake_cost_usage"}}, {project: {name: {_eq: "DSS-DE-Prod"}}}]}
) {
id
name
flow_runs(where: {state: {_eq: "Success"}}) {
parameters
start_time
id
state
name
}
}
}
Part of the response:
{
"parameters": {},
"start_time": "2021-09-12T04:00:09.013801+00:00",
"id": "aa1c50c3-5aed-44e2-90bb-634b605152a6",
"state": "Success",
"name": "zippy-malamute"
},
Snippet of specific flow_run’s parameters from Prefect UI:Ben Sack
09/17/2021, 3:13 PMBen Sack
09/17/2021, 3:19 PMflow_runs
does in fact return the correct result but the rest of them show "parameters": {}
. I can provide the entire result from the query if needed. Thanks!Kevin Kho
Ben Sack
09/17/2021, 3:25 PMwith Flow("snowflake_cost_usage") as flow:
process_date = Parameter(name="process_date", default=date_minus_seven())
spoke_accounts = Parameter(
name="spoke_accounts", default=list(SPOKE_ACCT_DBS.keys())
)
spoke_dbs = Parameter(name="spoke_dbs", default=list(SPOKE_ACCT_DBS.values()))
hub_account = Parameter(name="hub_account", default=HUB_ACCT)
hub_db = Parameter(name="hub_db", default=HUB_DB)
but I do see them in the Default Parameters section in the settings in Prefect UI as well. The parameters are static except for the process_date
Kevin Kho
Ben Sack
09/17/2021, 3:33 PMKevin Kho
query {
flow_run {
parameters
flow {
parameters
}
}
}
Kevin Kho
flow
parameters
will have the default like this:
{
"parameters": {
"account_identifier": "inrun"
},
"flow": {
"parameters": [
{
"name": "account_identifier",
"slug": "account_identifier",
"tags": [],
"type": "prefect.core.parameter.Parameter",
"default": null,
"outputs": "typing.Any",
"required": false,
"__version__": "0.15.5"
}
]
}
},
nicholas
query($parameters: jsonb) {
flow_run(where:{parameters: { _contains: $parameters }}) {
id
name
parameters
}
}
and in the Query Variables
section, you would paste the parameters you’re looking for, like this:
{
"parameters": {
"lat": 37.2761
}
}
nicholas
"lat": 37.2761
with whatever parameters you’re searching forBen Sack
09/17/2021, 3:40 PMnicholas
Ben Sack
09/17/2021, 3:58 PMquery variables
section I am getting the error with that syntax saying Expected value of type "jsonb"
Ben Sack
09/17/2021, 3:59 PM{
"parameters": {
"name": "process_date"
}
}
nicholas
"parameters": {
"process_date": "<<the process data you're looking for"
}
nicholas
Ben Sack
09/17/2021, 4:04 PMBen Sack
09/17/2021, 4:05 PMBen Sack
09/17/2021, 4:08 PMflow_name
rather than all of the parameters for all of the flows. Any thoughts on how to filter that since it seems I cannot use the where
clause for the flow_run.flow
Kevin Kho
query {
flow_run (where: {flow: {name: {_eq: "test"}}}) {
parameters
flow {
name
parameters
}
}
}
Ben Sack
09/17/2021, 5:10 PMBen Sack
09/17/2021, 5:10 PMKevin Kho
nicholas
nicholas
nicholas
query($parameters: jsonb) {
flow_run(where:{flow: {parameters: { _contains: $parameters }}}) {
id
name
parameters
flow {
id
parameters
}
}
}
with $parameters
variable of:
{
"parameters": [
{
"name": "lat",
"default": 37.2761
}
]
}
nicholas
nicholas
Ben Sack
09/17/2021, 6:19 PMdefault_parameters
for process_date
is always the same (since it is the process_date
that was initially calculated at flow build) rather than the process_date
that is generated from the flow’s docker storage (stored as script) each time the flow runsBen Sack
09/20/2021, 3:43 PMflow_run
parameters is a bug on the Prefect side? If not, I can check with other groups to see if they are able to get the correct results with the query I have. What I find strange is that the query returns the correct parameter results for two flow runs but empty results ("parameters": {}
) for all of the rest.Kevin Kho
parameters
part yep. Will open a ticket for this today. Just wondering, does the process_date
show up in the UI correctly?Ben Sack
09/20/2021, 4:46 PMBen Sack
09/20/2021, 4:53 PMprocess_date
parameter is always the same since that is the value that was calculated at flow build. But when you click into the task run
section for process_date
it shows the Result Location
equal to the correct process_date
that is calculated each time a flow runs (using docker storage). I have two snippets to better explain what I’m looking at:Ben Sack
09/20/2021, 4:54 PMResult Location
is equal to the correct process_date
, I can see at the bottom it shows Parameter:{}
Ben Sack
09/20/2021, 4:54 PMBen Sack
09/20/2021, 4:55 PMBen Sack
09/20/2021, 5:01 PMprocess_date
(as seen below). But the only difference between the versions was a change to a SQL statement to fix an issue on the database side and I don’t believe anything else was changed that would affect the flow or its parameters.Kevin Kho
Ben Sack
09/20/2021, 5:55 PMBen Sack
09/30/2021, 2:49 PMKevin Kho
Ben Sack
09/30/2021, 2:55 PMKevin Kho
Kevin Kho
Ben Sack
10/07/2021, 4:29 PMKevin Kho
Ben Sack
10/08/2021, 2:24 PMprocess_date
. Any thoughts/feedback on this method?Kevin Kho
Bring your towel and join one of the fastest growing data communities. Welcome to our second-generation open source orchestration platform, a completely rethought approach to dataflow automation.
Powered by