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:

Environment

Description

OS

Resources

Space Cloud workers

Virtual machines hosted in the Space cloud infrastructure. Learn more

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).

Containers in Space Cloud

Docker containers running in the Space cloud workers. Learn more

Linux only

Default: 2 vCPU, 7800 MB.

Max: 8 vCPU, 31200 MB.

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

Learn more

Self-hosted workers

Self-hosted hardware or virtual machines. Learn more

Linux, macOS, Windows

All available resources of the host machine

Containers in self-hosted workers

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

Linux only

All resources allocated to the container on the host machine

Choose run environment for a job

Space Automation chooses the run environment for a particular job based on the worker pool assigned to this job. Currently, there are two available pool types: Space Automation Cloud (default) and Self-Hosted Workers.

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 navigation bar, click administration.png Administration and choose Automation.

  2. Set the Default worker pool parameter: Space Automation Cloud or 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 requirements block makes requirements to the run environment more specific based on the following parameters:

workerPool: a worker pool. 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.

workerType: a worker instance. Currently, 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: 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 } } } }

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 } } } }
Last modified: 06 December 2022