Braun Reyes

    Braun Reyes

    1 year ago
    Does anyone know if there is a way to query cloud api for late flow runs?
    Jenny

    Jenny

    1 year ago
    Hi @Braun Reyes - We don't have a late state so you can't query for that directly. You could query for scheduled flow runs and check their scheduled_start_time against the current time. (Which is what the UI does.)
    query { flow_run (where: {state: {_eq:"Scheduled"}}){
      name
      id
      scheduled_start_time
    } }
    Braun Reyes

    Braun Reyes

    1 year ago
    Awesome thanks
    Jenny

    Jenny

    1 year ago
    Quick extra addition - if you want to put it all into your query you could use a less than operator and a datetime stamp and filter also by scheduled start time. https://hasura.io/docs/latest/graphql/core/databases/postgres/queries/query-filters.html
    Braun Reyes

    Braun Reyes

    1 year ago
    yeah I got pretty gnarly graphql query going to create a health check
    {
      flow(where: {
        project: {
          name: {
            _ilike: "%-prod"
            _neq: "dex-test-prod"
          }
        }
        archived: {
          _eq: false
        }
        schedule: {
          _is_null: false
        }
      }
      ) {
        value: 
        name
        project {
          name
        }
        flow_runs_aggregate(where: {
          state: {
            _eq: "Scheduled"
          }
          scheduled_start_time: {
            _lte: "2021-04-28T21:01:46.368Z"
          }
        }
        ){
          aggregate{
            min {
              scheduled_start_time
            }
            count(columns:[flow_id],distinct: true)
          }
        }
      }
    }