Samuel Hinton

    Samuel Hinton

    11 months ago
    Hey all! Just wondering if anyone more familiar with the client or API knows how to check and request how many flows have failed within the last X hours?
    Kevin Kho

    Kevin Kho

    11 months ago
    It will be something like this:
    query {
      flow_run (where: {state: {_eq: "Failed"}, 
                end_time: {_gt: "2021-09-22T14:00:00"}}){
        id
        name
        end_time
        state
      }
    }
    And then you likely need to process the results with Python
    To parameterize, I think this is a good sample
    Samuel Hinton

    Samuel Hinton

    11 months ago
    Ah awesome. And the correct way of sending that graphql would be via the
    prefect.client.client.Client.graphql
    api right?
    Kevin Kho

    Kevin Kho

    11 months ago
    Yeah
    from prefect.client.client import Client
    client = Client()
    client.graphql(query)
    Samuel Hinton

    Samuel Hinton

    11 months ago
    Fantastic, Ill play around with tomorrow, thanks @Kevin Kho.
    Hey @Kevin Kho, on a related by separate question, Im attempting to make a monthly pdf report (which uses some stats from prefect as per the above). I notice theres a Jupyter task which Im hoping to use to run and execute the report to a PDF, and I could use the email task to send it out. I looked into the slack task too, but it seems thats restricted to text only and doenst make use of the files.upload API slack has here: https://api.slack.com/methods/files.upload Is this correct / is there a different task I have missed, or is file attachments not currently supported out of the box?
    Kevin Kho

    Kevin Kho

    11 months ago
    I believe that is exactly right. If you get it working though, I think we’d appreciate a PR for that. I have also seen someone persist Jupyter notebooks as PDF artifacts, and then send the link over Slack so it can be hosted in the Prefect UI
    Samuel Hinton

    Samuel Hinton

    11 months ago
    Hey @Kevin Kho, another question from me - I see theres a dropbox download task (https://docs.prefect.io/api/latest/tasks/dropbox.html), is there a corresponding dropbox upload task Ive missed? If not, no issues, I can just make a generic python task that does it, just didnt want to reinvent the wheel
    Kevin Kho

    Kevin Kho

    11 months ago
    I haven’t seen any and I haven’t even seen anyone use dropbox actually. Is that for data storage?
    Samuel Hinton

    Samuel Hinton

    11 months ago
    It was mostly for a temp solution for storing reports for management/clients that already use dropbox and s3 would be a hoop to jump through. Ill just use the default dropbox sdk for now until I can scope out a proper reporting service and UI in our other projects to replace nasty PDF reports 🙂