Skip to main content

Storing Task Data Offline

If your computer is offline, or you do not want a Task's data and logs stored in the ClearML Server, use the Offline Mode option. In this mode, all the data and logs that the Task captures from the code are stored in a local session folder, which can be later uploaded to the ClearML Server.

Setting Task to Offline Mode

You can enable offline mode in one of the following ways:

  • Before initializing a task, use the Task.set_offline class method and set the offline_mode argument to True

    from clearml import Task
    # Use the set_offline class method before initializing a Task
    # Initialize a Task
    task = Task.init(project_name="examples", task_name="my_task")
  • Before running a task, set CLEARML_OFFLINE_MODE=1


Offline mode only works with tasks created using Task.init() and not with those created using Task.create().

All the information captured by the Task is saved locally. Once the task script finishes execution, it's zipped. The session's zip folder's location is ~/.clearml/cache/offline/<task_id>.zip.

The task's console output displays the task ID and a path to the folder with the session's captured information:

ClearML Task: created new task id=offline-372657bb04444c25a31bc6af86552cc9
ClearML Task: Offline session stored in /home/user/.clearml/cache/offline/

Uploading Session Data

Upload the session's execution data that the Task captured offline to the ClearML Server using one of the following:

  • clearml-task CLI

    clearml-task --import-offline-session "/home/user/.clearml/cache/offline/"

    Pass the path to the zip folder containing the session with the --import-offline-session parameter.

  • Task.import_offline_session method.

    from clearml import Task


    In the session_folder_zip argument, insert the path to the zip folder containing the session.

    To upload the session from the same script that created it, first close the task then disable offline mode:

    task = Task.init(project_name="examples", task_name="my_task")
    # task code

    You can also use the offline task to update the execution of an existing previously executed task by providing the previously executed task's ID. To avoid overwriting metrics, you can specify the initial iteration offset with iteration_offset.


Both options will upload the Task's full execution details and outputs and return a link to the Task's results page on the ClearML Server:

ClearML: Importing offline session from /home/user/.clearml/cache/offline/
ClearML results page:

The session details can be viewed in the ClearML WebApp, in the "my_task" experiment of the "examples" project, as specified when initializing the Task.