First example

In this first example, we are going to register ourselves into the application and collect some simple benchmarks and results.

Prepare your environment

Before starting, there are some pre requisites you need to full fill.

Read or terms and conditions

If you plan to upload data into EOSC Performance the first thing you would have to do is register. But before doing so, please read carefully our terms of service at performance.services.fedcloud.eu/terms-of-service.

Install and run oidc-agent

When you need to authenticate yourself at the API, for example to request POST methods, you need to attach an access-token to the http header. To get that header, we recommend the usage of oidc-agent.

Get your access-token in bash with the following command:

[1]:
access_token=$(oidc-token egi-prod)

Configure your environment

Not too complicate, for this example it is enough to select an API endpoint.

[2]:
eosc_perf_api="https://performance.services.fedcloud.eu/api/v1"

Register

Perform a POST request to /users:register. > You do not need to register for accessing benchmarks and results.

[ ]:
curl -X 'POST' \
  "$eosc_perf_api/users:register" \
  -H "Authorization: Bearer $access_token"

Search for a benchmark

Use the endpoint GET /benchmarks to download a list of all available benchmarks at EOSC Performance.

[4]:
benchmarks=$(curl -X 'GET' "$eosc_perf_api/benchmarks")
benchmarks_ids=$(echo $benchmarks | jq '.items[].id')
echo $benchmarks_ids | jq
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  2541  100  2541    0     0  15782      0 --:--:-- --:--:-- --:--:-- 15881
"5a0f5641-01ae-4f48-b5d1-84cd9c87dfac"
"8edf5bcf-d432-4f4f-930f-6245d7f49588"

A benchmark is composed by the following fields: - docker_image: Docker image referenced by the benchmark - docker_tag: Docker image version/tag referenced by the benchmark - json_schema: Schema used to validate benchmark results before upload

You should find the benchmark container image at Docker Hub using the docker_image and docker_tag fields.

[5]:
docker_image=$(echo $benchmarks | jq '.items[0].docker_image')
docker_tag=$(echo $benchmarks | jq '.items[0].docker_tag')
echo "$docker_image:$docker_tag"
"deephdc/deep-oc-benchmarks_cnn":"benchmark"

In addition, you can explore what can you expect from the schema accessing the benchmark schema.

[ ]:
echo $benchmarks | jq '.items[0].json_schema'

Collect all benchmark results

Now you have chosen a benchmark, use its id to perform a GET request to /results and retrieve the uploaded data from the community.

[7]:
benchmark_id='5a0f5641-01ae-4f48-b5d1-84cd9c87dfac'
results=$(curl -X 'GET' "$eosc_perf_api/results?benchmark_id=$benchmark_id")
results_ids=$(echo $results | jq '.items[].id')
echo $results_ids | jq
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 43513  100 43513    0     0   148k      0 --:--:-- --:--:-- --:--:--  148k
"69516c84-c610-4656-ac7b-d41849fb6cbc"
"124195c0-e5c8-459e-aca2-19a9665a4845"
"5736c4f3-ea86-477a-8ae9-0e0ae05f62a3"
"3212d315-72eb-4e63-8a91-25ece0718b18"
"c99a91a1-2fb0-4d42-88a1-ddc12e7bdaf8"
"e79a99b4-46f1-4ace-8d27-bc5f254b7a42"
"8a7a15fd-b759-4c09-9117-3dc328b915c2"
"889286ad-9e8d-47d2-a3f0-c07de330c81f"
"553cc539-f32e-4db5-9a41-89d759dcf5ae"
"8fe67271-b839-4dd4-807d-1c0a2eb04382"
"51b861a3-d1fe-403e-b2db-fa8467a40c0b"
"6926ab40-9d1a-462c-979d-21f1dd5df061"