Changeset View
Changeset View
Standalone View
Standalone View
js_modules/dagit/packages/core/src/runs/RunUtils.tsx
import {gql} from '@apollo/client'; | import {gql} from '@apollo/client'; | ||||
import {Icon, Popover} from '@blueprintjs/core'; | import {Icon, Popover} from '@blueprintjs/core'; | ||||
import * as React from 'react'; | import * as React from 'react'; | ||||
import * as yaml from 'yaml'; | import * as yaml from 'yaml'; | ||||
import {showCustomAlert} from '../app/CustomAlertProvider'; | import {showCustomAlert} from '../app/CustomAlertProvider'; | ||||
import {PythonErrorInfo, PYTHON_ERROR_FRAGMENT} from '../app/PythonErrorInfo'; | import {PythonErrorInfo, PYTHON_ERROR_FRAGMENT} from '../app/PythonErrorInfo'; | ||||
import {Timestamp} from '../app/time/Timestamp'; | import {Timestamp} from '../app/time/Timestamp'; | ||||
import {ExecutionParams, PipelineRunStatus} from '../types/globalTypes'; | import {ExecutionParams, PipelineRunStatus} from '../types/globalTypes'; | ||||
import {REPOSITORY_ORIGIN_FRAGMENT} from '../workspace/RepositoryInformation'; | |||||
import {DagsterTag} from './RunTag'; | import {DagsterTag} from './RunTag'; | ||||
import {StepSelection} from './StepSelection'; | import {StepSelection} from './StepSelection'; | ||||
import {TimeElapsed} from './TimeElapsed'; | import {TimeElapsed} from './TimeElapsed'; | ||||
import {LaunchPipelineExecution} from './types/LaunchPipelineExecution'; | import {LaunchPipelineExecution} from './types/LaunchPipelineExecution'; | ||||
import {LaunchPipelineReexecution} from './types/LaunchPipelineReexecution'; | import {LaunchPipelineReexecution} from './types/LaunchPipelineReexecution'; | ||||
import {RunActionMenuFragment} from './types/RunActionMenuFragment'; | |||||
import {RunFragment} from './types/RunFragment'; | import {RunFragment} from './types/RunFragment'; | ||||
import {RunTableRunFragment} from './types/RunTableRunFragment'; | import {RunTableRunFragment} from './types/RunTableRunFragment'; | ||||
import {RunTimeFragment} from './types/RunTimeFragment'; | import {RunTimeFragment} from './types/RunTimeFragment'; | ||||
export function titleForRun(run: {runId: string}) { | export function titleForRun(run: {runId: string}) { | ||||
return run.runId.split('-').shift(); | return run.runId.split('-').shift(); | ||||
} | } | ||||
Show All 33 Lines | if ('errors' in obj) { | ||||
.map((error) => error.message) | .map((error) => error.message) | ||||
.join('\n\n')}`; | .join('\n\n')}`; | ||||
} | } | ||||
showCustomAlert({body: message}); | showCustomAlert({body: message}); | ||||
} | } | ||||
} | } | ||||
function getBaseExecutionMetadata(run: RunFragment | RunTableRunFragment | RunActionMenuFragment) { | function getBaseExecutionMetadata(run: RunFragment | RunTableRunFragment) { | ||||
const hiddenTagKeys: string[] = [DagsterTag.IsResumeRetry, DagsterTag.StepSelection]; | const hiddenTagKeys: string[] = [DagsterTag.IsResumeRetry, DagsterTag.StepSelection]; | ||||
return { | return { | ||||
parentRunId: run.runId, | parentRunId: run.runId, | ||||
rootRunId: run.rootRunId ? run.rootRunId : run.runId, | rootRunId: run.rootRunId ? run.rootRunId : run.runId, | ||||
tags: [ | tags: [ | ||||
// Clean up tags related to run grouping once we decide its persistence | // Clean up tags related to run grouping once we decide its persistence | ||||
// https://github.com/dagster-io/dagster/issues/2495 | // https://github.com/dagster-io/dagster/issues/2495 | ||||
Show All 18 Lines | |||||
} | } | ||||
export type ReExecutionStyle = | export type ReExecutionStyle = | ||||
| {type: 'all'} | | {type: 'all'} | ||||
| {type: 'from-failure'} | | {type: 'from-failure'} | ||||
| {type: 'selection'; selection: StepSelection}; | | {type: 'selection'; selection: StepSelection}; | ||||
export function getReexecutionVariables(input: { | export function getReexecutionVariables(input: { | ||||
run: (RunFragment | RunTableRunFragment | RunActionMenuFragment) & {runConfigYaml: string}; | run: (RunFragment | RunTableRunFragment) & {runConfigYaml: string}; | ||||
style: ReExecutionStyle; | style: ReExecutionStyle; | ||||
repositoryLocationName: string; | repositoryLocationName: string; | ||||
repositoryName: string; | repositoryName: string; | ||||
}) { | }) { | ||||
const {run, style, repositoryLocationName, repositoryName} = input; | const {run, style, repositoryLocationName, repositoryName} = input; | ||||
if (!run || ('pipeline' in run && run.pipeline.__typename === 'UnknownPipeline')) { | if (!run || ('pipeline' in run && run.pipeline.__typename === 'UnknownPipeline')) { | ||||
return undefined; | return undefined; | ||||
▲ Show 20 Lines • Show All 198 Lines • ▼ Show 20 Lines | stats { | ||||
} | } | ||||
... on PythonError { | ... on PythonError { | ||||
...PythonErrorFragment | ...PythonErrorFragment | ||||
} | } | ||||
} | } | ||||
} | } | ||||
${PYTHON_ERROR_FRAGMENT} | ${PYTHON_ERROR_FRAGMENT} | ||||
`; | `; | ||||
export const RUN_ACTION_MENU_FRAGMENT = gql` | |||||
fragment RunActionMenuFragment on PipelineRun { | |||||
id | |||||
runId | |||||
rootRunId | |||||
pipelineName | |||||
solidSelection | |||||
pipelineSnapshotId | |||||
mode | |||||
canTerminate | |||||
tags { | |||||
key | |||||
value | |||||
} | |||||
status | |||||
repositoryOrigin { | |||||
id | |||||
...RepositoryOriginFragment | |||||
} | |||||
} | |||||
${REPOSITORY_ORIGIN_FRAGMENT} | |||||
`; |