From dcaa2bde5e81c176b9f42142f471f140fbebd84c Mon Sep 17 00:00:00 2001 From: James Sammut Date: Tue, 20 Jun 2023 09:09:27 +1000 Subject: [PATCH 1/3] Added Cluster Queue/Jobs example to GraphQL Cookbook --- pages/apis/graphql/graphql_cookbook.md | 58 ++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/pages/apis/graphql/graphql_cookbook.md b/pages/apis/graphql/graphql_cookbook.md index cbb4ad49b6..3142795524 100644 --- a/pages/apis/graphql/graphql_cookbook.md +++ b/pages/apis/graphql/graphql_cookbook.md @@ -541,6 +541,64 @@ mutation { } ``` +## Clusters + +A collection of common tasks with clusters using the GraphQL API. + +### List cluster queues + +List the first 20 cluster queues' key and ID for the first 10 clusters in the organisation + +```graphql +query getClusterQueues { + organization(slug: "organization-slug") { + clusters(first:10){ + edges{ + node{ + name + queues(first:20){ + edges{ + node{ + key + id + } + } + } + } + } + } + } +} +``` + +### List jobs as part of a specific 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. From db1c0da11037a2a657f4400e2ba9c7d43b994527 Mon Sep 17 00:00:00 2001 From: James Sammut Date: Tue, 20 Jun 2023 09:12:36 +1000 Subject: [PATCH 2/3] Supurflous close-bracket --- pages/apis/graphql/graphql_cookbook.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/apis/graphql/graphql_cookbook.md b/pages/apis/graphql/graphql_cookbook.md index 3142795524..84802b4e7a 100644 --- a/pages/apis/graphql/graphql_cookbook.md +++ b/pages/apis/graphql/graphql_cookbook.md @@ -573,7 +573,7 @@ query getClusterQueues { ### List jobs as part of a specific cluster queue -List the first 20 jobs as part of a cluster queue in the `RUNNING` [job state](/docs/apis/graphql/schemas/enum/jobstates)). +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 { From 1d6fc7f405741b6bede77d34bbe100100b907e40 Mon Sep 17 00:00:00 2001 From: James Sammut Date: Fri, 23 Jun 2023 10:24:03 +1000 Subject: [PATCH 3/3] Suggestion implementation --- pages/apis/graphql/graphql_cookbook.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pages/apis/graphql/graphql_cookbook.md b/pages/apis/graphql/graphql_cookbook.md index 84802b4e7a..53ee2f104f 100644 --- a/pages/apis/graphql/graphql_cookbook.md +++ b/pages/apis/graphql/graphql_cookbook.md @@ -545,9 +545,9 @@ mutation { A collection of common tasks with clusters using the GraphQL API. -### List cluster queues +### List cluster queues -List the first 20 cluster queues' key and ID for the first 10 clusters in the organisation +For the first 10 clusters in an organization, list the key and ID of the first 20 cluster queues. ```graphql query getClusterQueues { @@ -571,7 +571,7 @@ query getClusterQueues { } ``` -### List jobs as part of a specific cluster queue +### 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).