ACCESS requires all gateways to report the number of unique users per quarter who have executed jobs on ACCESS resources. ACCESS collects this information through a simple REST API that is integrated into the job submission process. It enables a gateway to submit the gateway user id of a job, the local job ID (obtained from the local resource manager), the submission time (also obtained from the local resource manager), and the submission host (configured by the local service provider) to special, restricted tables in the ACCESS Allocations Database. The REST API can also be used to submit optional software, usage, and VM id attributes (if applicable).
API key file format | curl option | |
---|---|---|
Old |
apikey=<APIKEY>
|
curl --data @$HOME/.gateway-attributes-apikey |
New |
header = "XA-API-Key: <APIKEY>"
|
curl -K $HOME/.gateway-attributes-apikey |
The old way will continue to be supported, but you are encouraged to update your configuration, if possible.
$ touch $HOME/.gateway-attributes-apikey
$ chmod 0600 $HOME/.gateway-attributes-apikey
$ cat > $HOME/.gateway-attributes-apikey header = "XA-API-Key: <paste your API key>"(don't forget the closing quote)<Enter> <ctrl-d>^D
DO NOT DO THIS!
$ curl -XPOST --header "XA-API-Key: example-123456abcd"
OR THIS
$ curl -XPOST --data-urlencode apikey=example-123456abcd
$sbatch mpi.job ... Submitted batch job 4937919From your gateway (where you stored your API key), then run the following curl command (or any HTTP compliant client API) to submit the needed attributes to the API:
$ curl -XPOST -K $HOME/.gateway-attributes-apikey \ --data-urlencode "gatewayuser=John Doe" \ --data-urlencode "xsederesourcename=comet.sdsc.xsede" \ --data-urlencode "jobid=4937919" \ --data-urlencode "submittime=2019-05-31 14:32 PST" \ https://allocations-api.access-ci.org/acdb/gateway/v2/job_attributes Job attributes: Job: 4937919 Job submitted: 2019-05-31 14:32:00-0700 Resource Name: comet.sdsc.xsede Gateway Name: example-gateway Gateway User: John DoeIf the job attributes were successfully submitted to the API, the API will return a summary of the attributes as shown in the example above. The attributes will be stored to a staging table in the XDCDB where it will be later matched with AMIE accounting records coming from the site. To verify that the information is matched correctly, you can use xdusage, a command-line tool available on SP resources to query the status of your ACCESS allocations. Run xdusage with "-ja" option as shown in the example below:
$ xdusage -j -ja -s 2019-05-31 -e 2019-06-01 -p TG-STA110011S . . . job id=4939827 resource=comet.sdsc.xsede submit=2019-05-31@14:32:28 start=2019-05-31@17:47:28 end=2015-05-31@17:57:37 nodecount=2 processors=32 queue=normal charge=24.89 job-attr id= 4939827 name=gateway-user value=John Doe
$ curl -XPOST -K $HOME/.gateway-attributes-apikey \ --data-urlencode "xsederesourcename=unknown" https://allocations-api.access-ci.org/acdb/gateway/v2/job_attributes
$ curl -XPOST -K $HOME/.gateway-attributes-apikey \ --data-urlencode "gatewayuser=John Doe" \ --data-urlencode "xsederesourcename=comet-gpu.sdsc.xsede" \ --data-urlencode "jobid=bogus" \ --data-urlencode "submittime=2019-01-31 23:45 PST" \ --data-urlencode "debug=x" \ https://allocations-api.access-ci.org/acdb/gateway/v2/job_attributes
$ curl -K $HOME/.gateway-attributes-apikey https://allocations-api.access-ci.org/acdb/gateway/v2/jobs
Field | Description | Format | Example |
---|---|---|---|
jobid | Batch submission job id | String | 12345 or use.jetstream-cloud.org-51511649 |
submittime | Approx. time when job was submitted or the VM was created on JetStream |
Date time | 2019-04-01 4:25 PST |
xsederesourcename | Name of the resource | Formatted string as: <resource>.<site>.xsede | (See "List resource names" section for the latest list of valid names) |
gatewayuser | First and Last name or email or username of the gateway user for that submitted the job |
String | John Doe or john@example.com or jdoe |
Field | Description | Format | Example |
---|---|---|---|
software | List of software used by the job |
Formatted string as: Single colon delimited key value pair or Multiple key value pairs in a comma separated list |
See "Reporting software attributes" below for format of key value pair |
vmid | Virtual machine ID | String | 5707f61b-c53b-4b1d-9059-ae6639c0f2e8-10840642 |
usage | Time consumed by job on a virtual machine | Integer (seconds) | 3600 |
debug | Flag for testing | String | Any value: debug=x |
<short common software package name>:<long full software package name>Each gateway can define their own common software names. Use a comma to separate multiple software packages. For example:
MATLAB:MATLAB R2019a, NumPy:NumPy v1.17
$ curl -XPOST -K $HOME/.gateway-attributes-apikey \ --data-urlencode "gatewayuser=John Doe" \ --data-urlencode "xsederesourcename=comet-gpu.sdsc.xsede" \ --data-urlencode "jobid=12345" \ --data-urlencode "submittime=2019-01-31 23:45 PST" \ --data-urlencode "software=MATLAB:MATLAB R2019a, NumPy:NumPy v1.17" \ https://allocations-api.access-ci.org/acdb/gateway/v2/job_attributes
$ curl -XPOST -K $HOME/.gateway-attributes-apikey \ --data-urlencode "xsederesourcename=jetstream.tacc.xsede" \ --data-urlencode "jobid=use.jetstream-cloud.org-51511649" \ --data-urlencode "gatewayuser=John Doe" \ --data-urlencode "submittime=2019-01-31 23:45 PST" \ --data-urlencode "software=MATLAB:MATLAB R2019a, NumPy:NumPy v1.17" \ --data-urlencode "vmid=5707f61b-c53b-4b1d-9059-ae6639c0f2e8-108406422" \ --data-urlencode "usage=3600" \ https://allocations-api.access-ci.org/acdb/gateway/v2/job_attributes
See description of vmid and usage in the Optional Atrributes above
$ curl -XPOST -K $HOME/.gateway-attributes-apikey https://allocations-api.access-ci.org/acdb/gateway/v2/job_attributes