Skip to main content

CS Batch

CS Batch is an Airavata-backed portal for launching registered applications as Slurm jobs. Airavata's batch server stages files, submits each run and records its progress; its REST interface is the batch API. This page is for researchers and PIs who launch runs or share an allocation, and assumes you know what an sbatch script is.

Available Version master · Try it out · Self-hosting

The steps below call the batch API directly; every route, with a curl example, is in docs/api.md in the Airavata repository.

Concepts​

An application is registered once and deployed to a cluster; each run of it is a process. The identity a job runs under is kept in a separate cluster configuration, which its owner can share with a group. These must exist before a run:

ResourceHoldsRegistered by
Slurm clusterLogin host and port, Slurm location, partitions and their limitsAn administrator
Cluster configurationLogin user, working directory and SSH key that runs submit underAny user; shareable
Application templateThe application's typed inputs and outputsAn administrator
Batch deploymentThe template on one cluster: a Jinja run section for the job script, default partition and resourcesAn administrator
Data storage, data productA host reachable by SCP, and a file or directory on itAny user; shareable
ProcessOne run: deployment, cluster configuration, resources, a data product per file input and outputAny user, who owns it

A run names data products, not paths, for its files.

Sign-in and sharing​

Sign-in is through CILogon. Every call that creates or launches something carries the resulting token as Authorization: Bearer <token>.

A PI can share a cluster configuration with a user or a group:

ShareGrantee may
READLaunch runs under it
WRITEAlso edit it

Only the owner or a platform administrator can delete a configuration or change its shares; no API call returns its SSH key.

Runs under a shared configuration are submitted as its cluster account; each run records the user who created it. A job is charged to the Slurm account in the run's allocation, or else to the login user's default account. Cluster security states what Airavata holds on your behalf.

Launch a run​

You need the server's base URL, a token, a batch deployment ID, and a cluster configuration you own or that is shared with you.

StepCallResult
1. Without a shared configuration, register your ownPOST /api/v1/ssh-keys, then POST /api/v1/slurm-cluster-configsA configuration ID
2. Register where file inputs come from and outputs goPOST /api/v1/scp-data-storages, then POST /api/v1/data-products per fileA data product ID per file
3. Create the runPOST /api/v1/processes with the deployment, configuration, resources and a value per input and outputA process ID, status CREATED
4. Launch itPOST /api/v1/processes/{id}/launch202 with the process; the work continues in the background

Only the run's owner or a platform administrator may launch it. A second launch of the same run is refused with 409; create a new process to run again.

Launch sequence​

After the launch returns:

StageDetail
Working directoryThe run's baseWorkDir, or else the configuration's work root, with the process ID beneath it
InputsNamed after the input in the working directory
Job scriptRendered from the run's resources, the deployment's default partition and its run section
Submissionsbatch over SSH as the configuration's login user, from the working directory
Job nameThe process ID
OutputsTaken from the file named after the output in the working directory, so the application must write it there
RetriesA failed copy is retried up to three times; a failed sbatch is not retried

Follow a run​

GET /api/v1/processes/{id} returns the run. Under batchProcess:

FieldShows
jobIdSlurm's job ID once sbatch accepted the script; use it with squeue and sacct
batchJobStatuses, latestBatchJobStatusSUBMITTED from Airavata, then one entry per Slurm mail: BEGIN, END, FAIL, REQUEUE, TIME_LIMIT, and the 50, 80 and 90 per cent warnings

The job's standard output and error are <process ID>.stdout and <process ID>.stderr in the working directory on the cluster. They are not copied back; read them over SSH.

When a run does not progress, its record points to the cause:

SymptomLikely causeDo
jobId still empty minutes after the launchA copy or sbatch failed; the reason is only in the server's logCheck the inputs' data products and the configuration's login, or ask your Airavata administrator
sacct shows the job finished, but the run has neither END nor FAILThe cluster's mail is not reaching Airavata; outputs are not copied backFetch the outputs from the working directory

Limitations​

AreaCurrent behaviour
SchedulersSlurm only, reached over SSH
Job statusFrom Slurm's notification e-mails only; a cluster that sends no Slurm mail reports nothing
Run statusStays CREATED; Slurm events are recorded as batch job statuses
CancellingNot implemented; use scancel on the cluster
File stagingFILE only; FILE_LIST and DIRECTORY inputs and outputs are skipped
Transfer pathEvery file passes through Airavata's server; large data is slow
PartitionThe deployment's default; a run cannot choose another
Resource limitsNot checked against the registered partition limits; Slurm and the site's submit filter decide
Reading a runNeeds no token: anyone with the process ID can read the run's record

For interactive work use VS Code or Jupyter sessions; for pipelines see Nextflow pipelines.