Recover a Run

If you want to download artifacts of the latest Lightly Worker run for a specific dataset, you can also get that run given the dataset_id instead of the scheduled_run_id:

from lightly.api import ApiWorkflowClient

# Create the Lightly client to connect to the API.
client = ApiWorkflowClient(token="MY_LIGHTLY_TOKEN", dataset_id="MY_DATASET_ID")

# get all runs for a given dataset sorted from old to new
runs = client.get_compute_worker_runs(dataset_id=client.dataset_id)
run = runs[-1] # get the latest run
client.download_compute_worker_run_artifacts(run=run, output_dir="my_run/artifacts")


The log file is one of the Other Outputs created during a Lightly Worker run. It contains valuable log messages for debugging. If your run is not processed correctly or an error occurred, this file contains more detailed information about what went wrong. You can also download the log file of a scheduled run with the API client:

run = client.get_compute_worker_run_from_scheduled_run(scheduled_run_id=scheduled_run_id)
client.download_compute_worker_run_log(run=run, output_path="my_run/artifacts/log.txt")

Memory Logs

The memory log file is particularly useful if the Lightly Worker crashes due to an Out-Of-Memory error. You can also download it with the API client:

# download the log file
run = client.get_compute_worker_run_from_scheduled(scheduled_run_id=scheduled_run_id)
client.download_compute_worker_run_memory_log(run=run, output_path="my_run/artifacts/memlog.txt")