2.3 KiB
title |
---|
Executable Experiment Containers |
This tutorial demonstrates using clearml-agent
's build
command to package an experiment into an executable container. In this example, you will build a Docker image that, when
run, will automatically execute the keras_tensorboard.py
script.
Prerequisites
clearml-agent
installed and configuredclearml
installed and configured- clearml repo cloned (
git clone https://github.com/allegroai/clearml.git
)
Creating the ClearML Experiment
-
Set up the experiment's execution environment:
cd clearml/examples/frameworks/keras pip install -r requirements.txt
-
Run the experiment:
python keras_tensorboard.py
This 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_task
:::tip If the container will not make use of a GPU, add the
--cpu-only
flag :::This command will create a Docker container, set up with the execution environment for this experiment in the specified
--target
folder. When the Docker container is launched, it will clone the task specified withid
and execute the clone (as designated by the--entry-point
parameter). -
Run the Docker, pointing to the new container:
docker run new-docker
The 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.