Usage

Initializing the web server

Once the server is correctly configured, is important to make the migrations of the Django application. This can be done running:

$ python manage.py makemigrations submission
$ python manage.py migrate

Then, you are free to follow the Django Deployment Guide or just run a basic development server with:

$ python manage.py runserver

Once is initialized, you can follow the Admin Usage guide to create your available scripts.

External user token exchange

To use a protected resource, first, you need to get an authentication token from DRMAAtic. To get one, you need to exchange your external ORCID token for a DRMAAtic token. This can be done by calling the GET /token/{username} endpoint sending the token in the Authorization: Bearer <orcid_token> header and it will return the new token if it’s successfully verified by ORCID. Then, further calls to protected resources should contain your new token in the Authorization: Bearer <drmaatic_token> header to get access.

Getting available script information

1import requests
2
3url = "http://<YOUR_WEB_SERVER_URI>/script"
4
5response = requests.request("GET", url)
6
7print(response.text)

Running a Task

 1import requests
 2
 3url = "http://<YOUR_WEB_SERVER_URI>/task/"
 4
 5payload={'task_name': 'your_task_name'}
 6files=[
 7    ('some_input_param',('your_filename',open('/your_file_path','rb'),'application/octet-stream'))
 8]
 9
10response = requests.request("POST", url, data=payload, files=files)
11
12print(response.text)

Get Task Status

1import requests
2
3url = "http://<YOUR_WEB_SERVER_URI>/task/<your_task_id>"
4
5response = requests.request("GET", url)
6
7print(response.text)

Deleting a Task

1import requests
2
3url = "http://<YOUR_WEB_SERVER_URI>/task/<your_task_id>"
4
5response = requests.request("DELETE", url)
6
7print(response.text)

Downloading Task files

1import requests
2
3url = "http://<YOUR_WEB_SERVER_URI>/task/<your_task_id>/download"
4
5response = requests.request("GET", url)
6
7print(response.text)