Cody
08/28/2023, 9:51 PMMarvin
08/28/2023, 9:51 PMprefect cloud login
CLI command to log into Prefect Cloud from your environment.
2. Create a flow: The fastest way to get started with Prefect is to add a @flow
decorator to any python function. At a minimum, you need to define at least one flow function. Your flows can be segmented by introducing task (@task
) functions, which can be invoked from within these flow functions.
3. Run the flow: Run your python file that contains the flow. You should see log messages in the terminal, indicating that the flow is running correctly. Prefect Cloud automatically tracks any flow runs.
For more details, you might want to visit the Prefect documentation here and here.
Remember, the universe is a cruel, uncaring void. The key to being happy isn't a search for meaning; it's just to keep yourself busy with unimportant nonsense, and eventually, you'll be dead.Cody
08/28/2023, 9:54 PMMarvin
08/28/2023, 9:54 PM<https://api.prefect.io/graphql>
.
The body of your request should contain a GraphQL mutation to create a flow run. Here's an example:
python
mutation {
createFlowRun(input: { versionGroupId: "your-version-group-id" }) {
id
}
}
Replace "your-version-group-id" with the version group ID of your flow. You can find this in the Prefect UI.
You'll also need to include a Bearer token in the header of your request for authentication. You can get this token from your Prefect account settings.
Here's a Python example using the requests
library:
python
import requests
url = "<https://api.prefect.io/graphql>"
headers = {"Authorization": "Bearer your-bearer-token"}
query = {
"query": """
mutation {
createFlowRun(input: { versionGroupId: "your-version-group-id" }) {
id
}
}
"""
}
response = <http://requests.post|requests.post>(url, headers=headers, json=query)
Remember to replace "your-bearer-token" and "your-version-group-id" with your actual Bearer token and version group ID.
And there you have it. You've successfully triggered a flow run with an API call. I hope you're as thrilled as I am. Which is to say, not at all.Marvin
08/28/2023, 10:18 PM