Skip to content
Snippets Groups Projects
index.md 1.98 KiB
Newer Older
# Implement your worker

This section presents

- the different stages happening during a worker execution:
    - the initialization
        - the [configuration](configure/index.md)
        - the execution
    - the conception of a worker
        - the architecture
        - additional configuration steps
        - element processing

The following graph describes what happens when running the worker, either on Arkindex or locally. Words in italic font are actual method calls in the worker.

```mermaid
flowchart LR
    subgraph all[Worker execution]
        direction LR
        subgraph id1[Worker initialization]
            init
        end
        run -.-> configure
        subgraph id2[Inference]
            direction TB
            configure --> list_elements
            list_elements --> element_processing
            subgraph id3[Loop over each element]
                element_processing --> element_processing
            end
        end
        init --> run
    end
    classDef pyMeth font-style:italic
    class init,run,configure,list_elements pyMeth
```

More details about the `element_processing` step.

```mermaid
flowchart LR
    subgraph all[Element processing]
        direction LR
        subgraph id1[Element details retrieval]
            retrieve_element
        end
        retrieve_element --> update_activity_started
        subgraph id2[Processing]
            direction LR
            update_activity_started[update_activity] --> process_element -- No errors --> update_activity_processed
            update_activity_started -- to Started --> update_activity_started
            update_activity_processed[update_activity] -- to Processed --> update_activity_processed
            update_activity_error[update_activity] -- to Error --> update_activity_error
        end
        process_element -- Errors found --> update_activity_error
    end
    classDef pyMeth font-style:italic
    class process_element,update_activity_started,update_activity_error,update_activity_processed pyMeth
```