- Install Prefect :-)
- sign up for Cloud 2.0 beta
- prefect.io
- Prefect 2.0 banner or (Product > Cloud 2.0)
- Get Started
- Sign up / Sign in
- Make API key
- Initial CLI setup
prefect cloud login
- You can run a flow right now and the metadata will be stored in Cloud because of the CLI setup
- Configure storage
- Create S3 bucket in your AWS account
prefect storage create
with your AWS bucket name and API keysprefect storage set-default {id}
if it wasn't already your default (prefect storage ls
to see all storage configs)
- Create a work queue
- Make in the UI or with the CLI command:
prefect work-queue create -fr KubernetesFlowRunner k8s-queue
- Make in the UI or with the CLI command:
- Create a deployment with
prefect deployment create {yourfile}.py
- Deploy agent using
kubectl apply -f agent-manifest.yaml
or a similar file with name of your work queue
Demo part 0
- Create deployment with
prefect deployment create basicflow-subprocess.py
- Start a local agent that will pick up local jobs
prefect agent start local-queue
- Deploy
prefect deployment run 'Demo/local-example'
- Edit the concurrency for the
db
tag:prefect concurrency-limit create db 1
- Run again
prefect deployment run 'Demo/local-example
'
Demo part 1
- Create deployment with
prefect deployment create basicflow-k8s.py
configured with 'dev' tag. - Consider two clusters’ node pools
- Dev - using t1.micro node pools. teeny tiny. really only good for one job at a time.
- Staging - using something bigger (for demo I used t3.medium). can run multiple jobs at once.
- Create new work queues for ‘dev’ and ‘staging’ tags, still for the k8s flow runner
- Limit the ‘dev’ work queue to only one at a time
- Limit the ‘staging’ work queue to 10 jobs at a time
- Create new agents, one for each work queue in the appropriate cluster
- Start up multiple runs for the deployment; they will go to the dev agent.
- Edit the flow to change the deployment's tag to 'staging' and re-deploy and run it, and it will now go to your staging agent.
Demo part 2
- Given a deployment tagged with
staging
fromprefect deployment create basicflow-k8s.py
. - Set a concurrency limit on the
db
tag. - Rerun as above.