Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Cluster Queue/Jobs example to GraphQL Cookbook #2224

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions pages/apis/graphql/graphql_cookbook.md
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,64 @@ mutation {
}
```

## Clusters

A collection of common tasks with clusters using the GraphQL API.

### List cluster queues

For the first 10 clusters in an organization, list the key and ID of the first 20 cluster queues.

```graphql
query getClusterQueues {
organization(slug: "organization-slug") {
clusters(first:10){
edges{
node{
name
queues(first:20){
edges{
node{
key
id
}
}
}
}
}
}
}
}
```

### List jobs in a cluster queue

List the first 20 jobs as part of a cluster queue in the `RUNNING` [job state](/docs/apis/graphql/schemas/enum/jobstates).

```graphql
query getClusterQueueJobs {
organization(slug:"organization-slug"){
jobs(first: 20, clusterQueue:"cluster-queue-id", state:[RUNNING]) {
edges{
node{
... on JobTypeCommand{
state
uuid
build{
id
number
pipeline{
name
}
}
}
}
}
}
}
}
```

## Organizations

A collection of common tasks with organizations using the GraphQL API.
Expand Down