Skip to content
Snippets Groups Projects
Commit 860bdcc9 authored by Valentin Rigal's avatar Valentin Rigal Committed by Yoann Schneider
Browse files

Update 'Run your worker locally' docs section

parent c79511c1
No related branches found
Tags 0.4.0rc2
1 merge request!574Update 'Run your worker locally' docs section
Pipeline #186225 passed
......@@ -2,16 +2,12 @@
Once you have implemented a worker, you can run it on some Arkindex elements on your own machine to test it.
!!! warning
This section has been deprecated as of the latest version of base-worker.
## Retrieving credentials
For a worker to run properly, you will need two types of credentials:
- An API token that gives the worker access to the API
- A worker version ID that lets the worker send results to Arkindex and report that those come from this particular worker version
- A worker run ID that lets the worker send results to Arkindex and report that those come from this particular worker run
### Retrieving a token
......@@ -19,49 +15,18 @@ For the worker to run, you will need an Arkindex authentication token. You can u
You can retrieve your personal API Token from your [profile page](https://doc.arkindex.org/users/auth/#personal-token).
### Retrieving a worker version ID
### Creating a user worker run
A worker version ID will be required in order to publish results. If your worker does not create any Arkindex element, classification, transcription, etc., you may skip this step.
Every object published from a worker in Arkindex is tracked using a worker run reference.
In order to test your worker, you can create a new user worker run by following the official Arkindex [documentation](https://doc.arkindex.org/workers/user-worker-runs/).
If this particular worker was already configured on this instance, you can use its existing worker version ID; otherwise, you will need to ask an Arkindex administrator to create a fake version ID.
#### To retrieve a worker version ID from an existing worker
### Retrieving a existing worker run ID
1. Open a web browser and browse to the Arkindex instance.
2. In the top-right user menu, click on **My repositories**.
3. Click on your worker, listed in the **Workers** column.
4. Rewrite the URL in your browser's address bar, to look like
`https://<arkindex_url>/api/v1/workers/<worker_id>/versions/`
- Replace `process` by `api/v1`
- Add a slash character (`/`) at the end
In the JSON output from this API endpoint, the first value next to `"id"` is the worker version ID.
#### To create a fake worker as an administrator
This action can only be done as an Arkindex administrator with shell access.
1. In the backend's Docker image, run:
```shell
arkindex fake_worker_version --name <NAME> --slug <SLUG> --url <URL>
```
Replace `<NAME>`, `<SLUG>` and `<URL>` with the name, slug and GitLab repository URL, respectively.
A Git repository is created with a fake OAuth access token. A fake Git revision is added to this repository, and a fake worker version from a fake worker is linked to this revision. You should get the following output:
```shell
Created a worker version: 392bd299-bc8f-4ec6-aa3c-e6503ecc7730
```
!!! warning
2. In the top-right user menu, click on **Worker Runs**.
This feature should only be used when a normal worker cannot be created using the Git workflow.
3. You can copy the ID of a listed worker by clicking in the ID column, or create a new one from the web interface.
## Setting credentials
......@@ -73,8 +38,8 @@ In a shell you need to set 3 environment variables to transmit your credentials
`ARKINDEX_API_TOKEN`
: The API token you retrieved earlier, on your profile page.
`WORKER_VERSION_ID`
: The worker version ID you retrieved earlier. Can be omitted if the worker does not create new data in Arkindex.
`ARKINDEX_WORKER_RUN_ID`
: The worker run ID you retrieved earlier. Can be omitted if the worker does not create new data in Arkindex.
### To set credentials for your worker
......@@ -83,7 +48,7 @@ In a shell you need to set 3 environment variables to transmit your credentials
```shell
export ARKINDEX_API_URL="https://arkindex.teklia.com"
export ARKINDEX_API_TOKEN="YOUR_TOKEN_HERE"
export WORKER_VERSION_ID="xxxxx"
export ARKINDEX_WORKER_RUN_ID="xxxxx"
```
!!! warning
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment