Skip to content

Latest commit

 

History

History
51 lines (32 loc) · 3.29 KB

job-queue.md

File metadata and controls

51 lines (32 loc) · 3.29 KB
copyright lastupdated keywords subcollection
years
2017, 2022
2022-10-27
schematics job queue, job queue process, pending queue, schematics pending queue
schematics

{{site.data.keyword.attribute-definition-list}}

Executing process of the {{site.data.keyword.bpshort}} job queue

{: #job-queue-process}

About job queue

{: #about-job-queue}

When a user generates plan, as a shared service {{site.data.keyword.bpshort}} queues all the user's jobs into a single job queue. Your jobs reside in a queue until scheduled to run in an environment. {{site.data.keyword.bpshort}} job queues use a scheduler to equitably available to the users.

Functioning of job queue

{: #functions-job-queue}

Depending upon the workload that is generated by the user and the time to run the jobs, the consumer can experience delays. The job queue ensures that {{site.data.keyword.bpshort}} is equitably available to all its users regardless of the load generated by a user.

Example

If an user-1 has 20 jobs waiting in the queue, and user-2 submits a new job. User-2 job waits into a queue, ahead of user-1's 20 jobs to make {{site.data.keyword.bpshort}} equitably available for both user-1 and user-2.

When does the job enter into the pending queue?

{: #pending-job-queue}

Following are the tasks of the job when it enter into pending queue.

  • your job requires more time to complete. Check that enough time is specified for the job to execute.
  • your image that is used by your job run does not exist. Check that the provided image details exist and right name is specified.
  • The environment variable parameters that are required by the job are not specified. Check that the environment variables are defined.
  • The commands or arguments that are passed to the job are not valid. Check that the argument flags specified are correct.

Timeout

{: #job-queue-timeout}

The Terraform jobs such as plan, apply, and destroy on a workspace should not generally take more than few hours to provision or deprovision the resources. If you are provisioning many resources simultaneously, which takes time in number of hours, it is suggested to split the resources into different workspaces. {{site.data.keyword.bpshort}} limits the execution time of a job to 24 hours. After 24 hours the jobs are terminated and the job is marked as STOPPED and workspace shows ACTIVE, or INACTIVE.

In the point of transition of the state file of 24 hours, an interrupt signal is sent to the command execution. A graceful period of 10 minutes is given for the command to finish. If not, a kill signal is sent and the job is stopped. A refresh is done after stopping the state file and other data is collected at the end. This is helpful, in cases where a Terraform command is stuck forever and user doesn't intervene.

In a job, multiple commands such as terraform init, terraform apply, and terraform refresh are executed. If the job times out in a command, all further commands gets only 10 minutes to finish. At the end of 10 minutes, each command is killed.

Example If a job is stuck forever on a Terraform apply, when the command is stopped, and if you run a refresh. If refresh is also stuck, after 15 minutes, a kill is executed. The Terraform local exec and remote exec already have a time limit of 30 minutes.