JetBrains Space Help

Run Environment

Space Automation run environment is based on the concept of workers. A worker is a lightweight agent that connects to Space Automation, gets jobs and source code, runs the jobs, and reports results back to Space. A worker can run in virtual machines in the Space Automation Cloud, your own self-hosted machines, and Docker containers. The following table summarizes possible run environments:

Step type

Environment

Description

OS and resources

host

Space Cloud workers

(not supported in Space On-Premises)

Virtual machines hosted in the Space cloud infrastructure. Learn more

OS: Linux. Planned: macOS, Windows

Default: 2 vCPU, 7800 MB.

Large: 4 vCPU, 15600 MB.

Extra large: 8 vCPU, 31200 MB (not available for the Free plan).

container

Containers in Space Cloud

Docker containers running in the Space cloud workers. Learn more

OS: Linux only

Default: 2 vCPU, 7800 MB.

Max: 8 vCPU, 31200 MB.

Max for the Free plan: 4 vCPU, 15600 MB.

Learn more

host

Self-hosted workers

Self-hosted hardware or virtual machines. Learn more

OS: Linux, macOS, Windows

All available resources of the host machine

container

Containers in self-hosted workers

Docker containers running on self-hosted hardware or virtual machines. Learn more

OS: Linux only

All resources allocated to the container on the host machine

Choose run environment for a job

The environment where a job will eventually run depends on:

For better understanding how to run a job in a particular environment, see Examples.

Default worker pool

The default pool for running jobs is defined by the Default worker pool parameter on the organization and project levels. The project-level parameter has priority over the organization-level one.

To change the default worker pool for the organization

  1. On the main menu, click administration.png Administration and choose Automation.

  2. Set the Default worker pool parameter:

    • Space Automation Cloud – to use cloud workers.

    • Self-Hosted Workers – to use self-hosted workers.

    Default worker pool

To change the default worker pool for a project

  1. Open the project and then open the Jobs page.

  2. Click Settings.

  3. Set the Default worker pool parameter: Space Automation Cloud or Self-Hosted Workers.

Job requirements

// the job will run on regular instance in the Space Cloud pool // regardless of the 'Default worker pool' value job("Example") { // worker requirements requirements { // workerPool = WorkerPools.SPACE_CLOUD // not necessary if workerType is specified workerType = WorkerTypes.SPACE_CLOUD_UBUNTU_LTS_REGULAR } host("Run script") { shellScript { content = "echo Hello World!" } } }

The job.requirements block makes requirements to the run environment more specific based on the following parameters:

Worker pool

job.requirements.workerPool: If specified, overrides the Default worker pool value. Possible values:

  • WorkerPools.SPACE_CLOUD or "space-cloud" for Space Automation Cloud.

  • WorkerPools.SELF_HOSTED or "self-hosted.default" for self-hosted workers.

Worker type

job.requirements.workerType: specifies a worker instance. Now, you can use this parameter only to specify worker instance type in Space Automation Cloud:

  • WorkerTypes.SPACE_CLOUD_UBUNTU_LTS_REGULAR or "space-cloud.ubuntu-lts.regular" (default)

  • WorkerTypes.SPACE_CLOUD_UBUNTU_LTS_LARGE or "space-cloud.ubuntu-lts.large"

  • WorkerTypes.SPACE_CLOUD_UBUNTU_LTS_XLARGE or "space-cloud.ubuntu-lts.xlarge"

Resources

job.requirements.resources: depending on a worker pool, Space will choose either a cloud worker or self-hosted worker instance that meets the specified resources requirements: minCpu and minMemory. Note that if you also specify resources on the host level, Space will look for suitable worker based on the higher resource requirements. For example:

// this job will run on a worker // that has at least 2.cpu and 4000.mb job("Example") { requirements { resources { minCpu = 1.cpu minMemory = 2000.mb } } // the container will be limited to 1.cpu and 2000.mb container(displayName = "Say Hello", image = "hello-world") host("Say Hello 2") { shellScript { content = "echo Hello World!" } // these requirements override job's requirements // as they are higher requirements { resources { minCpu = 2.cpu minMemory = 4000.mb } } } }

Run environments in Space On-Premises

Support for different run environments depends on Space On-Premises installation type:

  • Docker Compose installation:

    • Self-hosted workers – full support.

    • Cloud workers – not supported.

  • Kubernetes installation:

    • Self-hosted workers – full support.

    • Cloud workers – as Kubernetes implies running workload in containers only, the behavior will be different if Automation is configured to run a job in the cloud (e.g., Space Automation Cloud is selected in Jobs settings or job.requirements has workerPool = WorkerPools.SPACE_CLOUD). In this case, even if a job uses a host block, Automation will run it in a Docker container:

      1. Regardless of what is specified in job.requirements.workerType, the container has 2 vCPU and 7800 MB memory.

      2. The container image is based on Alpine Linux and provides support for Docker and Docker Compose.

Examples

Below you will find examples on how to run jobs in various environments.

// regular cloud worker with ubuntu lts // Set 'Default worker pool' to 'Space Automation Cloud' job("Example") { host { // ... } }
// large cloud worker with ubuntu lts // Set 'Default worker pool' to 'Space Automation Cloud' job("Example") { requirements { resources { minCpu = 4.cpu minMemory = 4000.mb } } host { // ... } }
// regular cloud worker with ubuntu lts // 'Default worker pool' is ignored job("Example") { requirements { // use the Space Automation cloud pool workerPool = WorkerPools.SPACE_CLOUD } host { // ... } }
// large cloud worker with ubuntu lts // 'Default worker pool' is ignored job("Example") { requirements { workerType = WorkerTypes.SPACE_CLOUD_UBUNTU_LTS_LARGE } host { // ... } }
// container in a regular cloud worker // Set 'Default worker pool' to 'Space Automation Cloud' job("Example") { container(image = "amazoncorretto:17-alpine") { // ... } }
// container in a large cloud worker // Set 'Default worker pool' to 'Space Automation Cloud' job("Example") { requirements { resources { minCpu = 4.cpu minMemory = 4000.mb } } container(image = "amazoncorretto:17-alpine") { // ... } }
// container in a regular cloud worker // 'Default worker pool' is ignored job("Example") { requirements { // use the Space Automation cloud pool workerPool = WorkerPools.SPACE_CLOUD } container(image = "amazoncorretto:17-alpine") { // ... } }
// container in a large cloud worker // 'Default worker pool' is ignored job("Example") { requirements { workerType = WorkerTypes.SPACE_CLOUD_UBUNTU_LTS_LARGE } container(image = "amazoncorretto:17-alpine") { // ... } }
// any suitable self-hosted worker // Set 'Default worker pool' to 'Self-Hosted Workers' job("Example") { host { // ... } }
// any suitable self-hosted worker // 'Default worker pool' is ignored job("Example") { requirements { workerPool = WorkerPools.SELF_HOSTED } host { // ... } }
// a self-hosted worker with Tag1 // 'Default worker pool' is ignored job("Example") { host { // ... requirements { workerTags("Tag1") } } }
// a self-hosted worker with // at least 4cpu and 4000mb // 'Default worker pool' is ignored job("Example") { requirements { resources { minCpu = 4.cpu minMemory = 4000.mb } } host { // ... } }
// a self-hosted worker with // at least 4cpu and 4000mb // 'Default worker pool' is ignored job("Example") { host { // ... requirements { resources { minCpu = 4.cpu minMemory = 4000.mb } } } }
// any suitable self-hosted worker // with Linux, Docker, and Docker Compose // Set 'Default worker pool' to 'Self-Hosted Workers' job("Example") { container(image = "amazoncorretto:17-alpine") { // ... } }
// any suitable self-hosted worker // with Linux, Docker, and Docker Compose // 'Default worker pool' is ignored job("Example") { requirements { workerPool = WorkerPools.SELF_HOSTED } container(image = "amazoncorretto:17-alpine") { // ... } }
// a self-hosted worker with Tag1 // 'Default worker pool' is ignored job("Example") { container(image = "amazoncorretto:17-alpine") { // ... requirements { workerTags("Tag1") } } }
// a self-hosted worker with // at least 4cpu and 4000mb // 'Default worker pool' is ignored job("Example") { requirements { resources { minCpu = 4.cpu minMemory = 4000.mb } } container(image = "amazoncorretto:17-alpine") { // ... } }
// a self-hosted worker with // at least 4cpu and 4000mb // 'Default worker pool' is ignored job("Example") { container(image = "amazoncorretto:17-alpine") { // ... requirements { resources { minCpu = 4.cpu minMemory = 4000.mb } } } }
// Everything works as in Space Cloud except when // the job is configured to run on the Space Automation cloud pool. // The job below will run in a "regular" container on a Kubernetes worker. job("Example") { requirements { workerPool = WorkerPools.SPACE_CLOUD } host { // ... } }
Last modified: 15 December 2023