Last noob question before I actually run a POC I p...
# prefect-server
m
Last noob question before I actually run a POC I promise "Where is an example of prefect task that just runs a pre-built Docker container." I've read the docs extensively, and I think this is covered with LocalExecutor + DockerRun, but the examples are confusing me -- they seem to all be set up for executing some prefect flow python code from the flow run on various environments. Here is my use case: • I have data transform code written in Julia, in a docker container already built with an environment to execute that Julia code, along with permissions to access s3 for read/write on either end of the execution. • I just want to schedule the running of this container (Fargate, EKS?) • Does Prefect need to be installed on the container? • Does the flow code need to execute some python commands in the container to start it off? This probably seems obvious, but its not to me. I want to use Prefect as an orchestrator for many kinds of jobs (Spark, julialang, shell calls to internal team services), and the API is full of environment-specific tasks like "AWS Tasks", "DBT Tasks", "Shell Tasks", etc. I am confused if generic docker containers can be run or if only the kind of tasks from the API documentation can be run.
Maybe this should have been prefect-community channel. I'll share to there as well, hopefully that isn't annoying.
k
Hey, I think that in this case, you want to use the StartContainer task to start your container inside a Python flow. Prefect will be installed on the container. You would have a small Flow script that uses the StartContainer task.
1
🙏 1
m
Excellent, thank you. The included link to docker docs helps a lot. This seems like a use-case that deserves an example in the tutorial docs, I imagine it could be very common.
k
Will keep that in mind!
m
Followup conceptual question: What happens if you start a container that does not contain the prefect flow code, or has prefect installed for that matter? In a general sense, I want my workflow orchestration to be able to initiate arbitrary software events. In the case of docker the entire environment and code of any kind can be a black box, the docker API should provide the minimum feedback about successful start and success/fail of the container.
k
I think you can follow something like this .
m
Oh thats perfect, thank you!