Executable Task Containers
This tutorial demonstrates using clearml-agent's build
command to package a task into an executable container. In this example, you will build a container image that, when
run, will automatically execute the keras_tensorboard.py
script.
Prerequisites
clearml-agentinstalled and configuredclearmlinstalled and configured- clearml repo cloned (
git clone https://github.com/clearml/clearml.git)
Creating the ClearML Task
-
Set up the task's execution environment:
cd clearml/examples/frameworks/keras
pip install -r requirements.txt -
Run the task:
python keras_tensorboard.pyThis creates a ClearML task called "Keras with TensorBoard example" in the "examples" project.
Note the task ID in the console output when running the script above:
ClearML Task: created new task id=<TASK_ID>This ID will be used in the following section.
Building and Launching a Containerized Task
-
Execute the following command to build the container. Input the ID of the task created above:
clearml-agent build --id <TASK_ID> --docker --target new-docker --entry-point clone_tasktipIf the container will not make use of a GPU, add the
--cpu-onlyflag.This command will create a container, set up with the execution environment for this task in the specified
--targetfolder. When the container is launched, it will clone the task specified withidand execute the clone (as designated by the--entry-pointparameter). -
Run the Docker, pointing to the new container:
docker run new-dockerThe task will be executed inside the container. Task details can be viewed in the ClearML Web UI.
For additional ClearML Agent options, see the ClearML Agent reference page.