Files
tracer-cloud--opensre/integrations/dagster/queries.py
T
wehub-resource-sync 4b6817381b
CI (OpenClaw E2E) / openclaw test (push) Has been cancelled
CI / coverage-report (push) Has been cancelled
CI / test-kubernetes (push) Has been cancelled
CI / should-run-thorough (push) Has been cancelled
CI / test-thorough (cloudwatch-demo) (push) Has been cancelled
CI / test-thorough (flink-ecs) (push) Has been cancelled
CI / test-thorough (upstream-lambda) (push) Has been cancelled
CI / test-thorough (prefect-ecs-fargate) (push) Has been cancelled
Release / build-binaries (zip, opensre.exe, onefile, windows-latest, windows-x64) (push) Has been cancelled
Benchmark image — build + push to ECR (any adapter) / build + push (push) Has been cancelled
CI / quality (ubuntu-latest) (push) Has been cancelled
CI / test (tools-runtime) (push) Has been cancelled
CI / test (e2e-general) (push) Has been cancelled
CI / test (cli-runtime) (push) Has been cancelled
CI / test (e2e-provider-and-openclaw) (push) Has been cancelled
CI / test (integrations-and-misc) (push) Has been cancelled
Release / verify (push) Has been cancelled
Release / build-python-dist (push) Has been cancelled
Release / build-binaries (tar.gz, opensre, onedir, macos-15-intel, darwin-x64) (push) Has been cancelled
Release / build-binaries (tar.gz, opensre, onedir, macos-latest, darwin-arm64) (push) Has been cancelled
Release / build-binaries (tar.gz, opensre, onedir, ubuntu-22.04, linux-x64) (push) Has been cancelled
Release / publish-release (push) Has been cancelled
Release / publish-main-release (push) Has been cancelled
Interactive Shell Live (PR + post-merge) / turn-checks (no-LLM) (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
Interactive Shell Live (PR + post-merge) / turn-live shard ${{ matrix.shard_index }} (push) Has been cancelled
Release / prepare (push) Has been cancelled
Release / build-binaries (tar.gz, opensre, onedir, ubuntu-22.04-arm, linux-arm64) (push) Has been cancelled
Synthetic Deterministic Tests / Synthetic offline (deterministic) (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:10:45 +08:00

195 lines
4.4 KiB
Python

"""GraphQL query strings issued by the Dagster client.
Each constant is the GraphQL document for one tool's primary query. Variables
are passed alongside the query in the POST body. Query shapes verified
against the Dagster GraphQL schema dump at
``js_modules/ui-core/src/graphql/schema.graphql`` in the upstream repo,
plus the canonical ``.graphql`` examples in the
``dagster-rest-resources`` library.
Notes on Dagster's schema worth knowing when reading or editing these:
- Pipeline-to-job rename: prefer ``jobName`` over ``pipelineName`` for new
callers. ``pipelineName`` survives as a legacy alias.
- ``runsOrError`` is a three-member union: ``Runs | InvalidPipelineRunsFilterError | PythonError``.
All three must be handled.
- Event log access goes through the top-level ``logsForRun`` query returning
``EventConnectionOrError``. The events are a ``DagsterRunEvent`` union, so
inline fragments per event type are required to read error details.
- ``SensorSelector`` requires all three of ``repositoryName``,
``repositoryLocationName``, ``sensorName``. Just the sensor name is not
enough to identify a sensor in Dagster.
"""
from __future__ import annotations
# List recent runs, optionally filtered by RunStatus values.
# Valid statuses (from schema): QUEUED, NOT_STARTED, MANAGED, STARTING,
# STARTED, SUCCESS, FAILURE, CANCELING, CANCELED.
LIST_RUNS = """
query ListRuns($limit: Int!, $statuses: [RunStatus!], $pipelineName: String) {
runsOrError(filter: {statuses: $statuses, pipelineName: $pipelineName}, limit: $limit) {
__typename
... on Runs {
results {
runId
status
jobName
startTime
endTime
creationTime
}
count
}
... on InvalidPipelineRunsFilterError {
message
}
... on PythonError {
message
}
}
}
"""
# Fetch a run's event log via top-level logsForRun (preferred over
# runOrError.eventConnection); events are a DagsterRunEvent union.
GET_RUN_LOGS = """
query GetRunLogs($runId: ID!, $limit: Int, $afterCursor: String) {
logsForRun(runId: $runId, limit: $limit, afterCursor: $afterCursor) {
__typename
... on EventConnection {
events {
__typename
... on MessageEvent {
runId
message
timestamp
level
stepKey
eventType
}
... on ExecutionStepFailureEvent {
error {
message
stack
className
cause {
message
stack
className
}
}
}
... on RunFailureEvent {
error {
message
stack
className
cause {
message
stack
className
}
}
}
}
cursor
hasMore
}
... on RunNotFoundError {
message
}
... on PythonError {
message
}
}
}
"""
# List assets with their most recent materialization (limit=1 per asset).
LIST_ASSETS = """
query ListAssets($limit: Int!) {
assetsOrError(limit: $limit) {
__typename
... on AssetConnection {
nodes {
key {
path
}
assetMaterializations(limit: 1) {
timestamp
runId
partition
}
}
cursor
}
... on PythonError {
message
}
}
}
"""
LIST_SENSOR_TICKS = """
query SensorTicks($sensorSelector: SensorSelector!, $limit: Int) {
sensorOrError(sensorSelector: $sensorSelector) {
__typename
... on Sensor {
name
sensorState {
ticks(limit: $limit) {
id
status
timestamp
endTimestamp
runIds
skipReason
error {
message
stack
}
}
}
}
... on SensorNotFoundError {
message
}
... on PythonError {
message
}
}
}
"""
LIST_SCHEDULE_TICKS = """
query ScheduleTicks($scheduleSelector: ScheduleSelector!, $limit: Int) {
scheduleOrError(scheduleSelector: $scheduleSelector) {
__typename
... on Schedule {
name
scheduleState {
ticks(limit: $limit) {
id
status
timestamp
endTimestamp
runIds
skipReason
error {
message
stack
}
}
}
}
... on ScheduleNotFoundError {
message
}
... on PythonError {
message
}
}
}
"""