Qbs Manual

Qbs 1.14.0

Group ◦ Module

# JobLimit QML Type

Restricts concurrent execution of jobs in a given pool. More...

Import Statement: | import QbsLanguageItems .

- List of all members, including inherited members

## Properties

- condition : bool
- jobCount : int
- jobPool : string

## Detailed Description

In addition to the global limit on concurrently running commands, a project might want to restrict concurrent execution of certain types of commands even further, for instance because they are not well-suited to share certain types of resources.

In the following example, we define a rule that runs a tool of which at most one instance can be running for the same project at any given time:

      Rule {
          // ...
          prepare: {
              var cmd = new Command("my-exclusive-tool", [project.buildDirectory]);
              cmd.description = "running the exclusive tool";
              cmd.jobPool = "exclusive_tool";
              return cmd;
          }
      }
      JobLimit {
          jobPool: "exclusive_tool"
          jobCount: 1
      }

`JobLimit` items can appear inside Product, Project and Module items. In the case of collisions, that is, items matching the same job pool but setting different values, the ones defined inside products have the highest precedence, and the ones inside modules have the lowest. Items defined in sub-projects have higher precedence than those defined in parent projects. For items with the same precedence level, the most restrictive one is chosen, that is, the one with the lowest job number greater than zero.

See also How do I limit the number of concurrent jobs for the linker only?.

## Property Documentation

condition : bool

Determines whether the job limit is active.

If this property is set to `false`, the job limit is ignored.

Default: `true`

jobCount : int

The maximum number of commands in the given job pool that can run concurrently.

A value of zero means "unlimited", negative values are not allowed.

Note: The global job limit always applies: For instance, if you set this property to 100 for some job pool, and "-j 8" was given on the command line, then no more than eight instances of commands from the respective job pool will run at any time.

This property must always be set.

Default: Undefined

jobPool : string

The job pool to which apply the limit.

This property must always be set to a non-empty value.

Default: Undefined

Group ◦ Module