---
title: Complete Workflow
description: >-
  This tutorial covers a full experiment lifecycle: 1. initialize a run 2. log
  metadata, metrics, and artifacts 4. reconnect later 5. retrieve metadata
  and...
canonical: >-
  https://lightning.ai/docs/platform/train/experiment-management/tutorials/complete_workflow
---
# Complete Workflow {#complete-workflow}

This tutorial covers a full experiment lifecycle:

1. initialize a run
2. log metadata, metrics, and artifacts
3. finalize
4. reconnect later
5. retrieve metadata and files

![Comparing experiment metrics with charts](https://media.lightning.ai/litlogger/experiment_comparison_charts.png)

## Train Script {#train-script}

```python
import json

import litlogger
from litlogger import File

config = {"model": "ResNet50", "lr": 0.001}
with open("config.json", "w") as f:
    json.dump(config, f)

experiment = litlogger.init(name="image-classifier")

# Set metadata
experiment["model"] = "ResNet50"
experiment["dataset"] = "CIFAR10"

# Log a static file
experiment["config"] = File("config.json")

# Log training metrics
for epoch in range(10):
    experiment["loss"].append(1.0 / (epoch + 1), step=epoch)

experiment.finalize()

```

## Fetch Script {#fetch-script}

```python
"""Fetch data from a previously logged experiment.

This script resumes the 'image-classifier' experiment and reads back
metadata and artifacts using the dict-like API.
"""

import json

import litlogger

experiment = litlogger.init(name="image-classifier")

# Read metadata via property
metadata = experiment.metadata
print(f"Metadata: {metadata}")

# Read artifacts and download
artifacts = experiment.artifacts
if "config" in artifacts:
    artifacts["config"].save("/tmp/config.json")
    with open("/tmp/config.json") as f:
        print(f"Config: {json.load(f)}")

experiment.finalize()

```

## What This Covers {#what-this-covers}

- experiment creation by name
- metadata logging
- metric logging
- artifact upload
- reconnection to an existing experiment
- file download and metadata access

## Related Guides {#related-guides}

- [Standalone Usage](/docs/platform/train/experiment-management/tutorials/experiment-management/guide/standalone.md)
- [Logging Artifacts](/docs/platform/train/experiment-management/tutorials/experiment-management/guide/artifacts.md)
- [Workflows](/docs/platform/train/experiment-management/tutorials/experiment-management/guide/workflows.md)

---

**Navigation**

- Parent: [Tutorials](/docs/platform/train/experiment-management/tutorials.md)
