Projects

A project is a folder for runs that belong together, such as all the tests for one drone. You make a project, put runs in it, and read them back later. The library lets you create, list, rename and delete projects.

python
from thrustlab import Client

client = Client()

project = client.projects.create(name="7-inch long range")
print(project["id"])

The result is a dictionary. Its id starts with proj_, and you pass it as project_id when you start a run. A run you start without one goes to your default project.

Create and read

create takes a name of 1 to 255 characters and nothing else. To add notes or an aircraft type tag, call update afterward.

python
project = client.projects.retrieve("proj_...")

retrieve fetches one project by its id. A project that doesn't exist, or belongs to someone else, raises a NotFoundError.

List your projects

python
for project in client.projects.list():
    print(project["name"], project["run_count"], project["last_activity_at"])

Each project comes with a summary of its runs: run_count, completed_count, failed_count, in_progress_count and waiting_count. in_progress_count is how many runs a worker is running now, and waiting_count is how many sit in the queue. See Pagination for how the loop fetches pages.

Rename or add notes

Pass the fields you want to change. Anything you leave out stays as it was.

python
client.projects.update(project["id"], name="7-inch, version 2", notes="New motors")

A project must always have a name, so you can't set name to None.

Delete a project

python
client.projects.delete(project["id"])

Deleting a project also deletes every run and starred part inside it. You can't undo it, so fetch any results you want to keep first.

If the project still has runs that are queued or running, the call fails with a ConflictError and the code project_has_active_runs. Cancel those runs or wait for them to finish, then try again.