# Microservices, tasks and jobs

There are three units of "work" in Archivematica, which you can see in the Archivematica dashboard:

![](https://681624210-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDAM268qVZ2nrq3bsj6TI%2Fuploads%2Fgit-blob-fb411de650ab5a9d5d5ded8215c92d64245f4f0c%2Fmicroservices_screenshot.png?alt=media)

The top level unit is the *microservice*, for example `Create SIP from Transfer`.

Each microservice runs a number of *jobs*. Each job is doing a different action – for example, `Check transfer directory for objects` or `Load options to create SIPs`.

Each job may spawn one or more *tasks*, which are the Python scripts that run under the hood. You can see the tasks by clicking the gear icon. Often tasks run on a per-file basis: if there are 100 files in a transfer package and you need to perform an action on each file, there would be 100 tasks.

Microservices contain jobs, jobs spawn tasks:

![](https://681624210-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDAM268qVZ2nrq3bsj6TI%2Fuploads%2Fgit-blob-c1771420daa77361817414b54944d5907d10a9d5%2Fmicroservices.svg?alt=media)

Sometimes actions get stuck and need to be restarted; the only way I know how to do this is to restart the Archivematica containers (more on that below). Doing this may cause weird things to happen:

* When the job is re-run, it gets scheduled twice, which might cause interesting things to happen downstream. Here's an example: this ingest had failed at the `Prepare AIP` step, I restarted the containers, and every job in and after Prepare AIP was run twice:

  ![](https://681624210-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDAM268qVZ2nrq3bsj6TI%2Fuploads%2Fgit-blob-fc68e6fe3a526dda1009e1cbfbdd2edabfae4d4b%2Fdouble_scheduling_task.png?alt=media)
* Not all tasks tolerate being run twice, e.g. they try to create a directory and fail if the directory already exists (from a previous run of the task).

##
