Skip to content

Commit

Permalink
[dagit] If re-executing from failure fails, default to from failure a…
Browse files Browse the repository at this point in the history
…gain #5019 (#7189)
  • Loading branch information
bengotow committed Mar 31, 2022
1 parent 6ecb496 commit 8f271ef
Showing 1 changed file with 22 additions and 10 deletions.
32 changes: 22 additions & 10 deletions js_modules/dagit/packages/core/src/runs/RunActionButtons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,11 @@ export const RunActionButtons: React.FC<RunActionButtonsProps> = (props) => {
const pipelineError = usePipelineAvailabilityErrorForRun(run);

const selection = stepSelectionWithState(props.selection, metadata);
const selectionOfCurrentRun = stepSelectionFromRunTags(run, graph, metadata);

const currentRunSelection = stepSelectionFromRunTags(run, graph, metadata);
const currentRunIsFromFailure = run.tags?.some(
(t) => t.key === DagsterTag.IsResumeRetry && t.value === 'true',
);

const full: LaunchButtonConfiguration = {
icon: 'cached',
Expand All @@ -126,21 +130,20 @@ export const RunActionButtons: React.FC<RunActionButtonsProps> = (props) => {

const same: LaunchButtonConfiguration = {
icon: 'linear_scale',
scope: selectionOfCurrentRun?.query || '*',
scope: currentRunSelection?.query || '*',
title: 'Same Steps',
disabled:
!selectionOfCurrentRun || !(selectionOfCurrentRun.finished || selectionOfCurrentRun.failed),
disabled: !currentRunSelection || !(currentRunSelection.finished || currentRunSelection.failed),
tooltip: (
<div>
{!selectionOfCurrentRun || !selectionOfCurrentRun.present
{!currentRunSelection || !currentRunSelection.present
? 'Re-executes the same step subset used for this run if one was present.'
: !selectionOfCurrentRun.finished
: !currentRunSelection.finished
? 'Wait for all of the steps to finish to re-execute the same subset.'
: 'Re-execute the same step subset used for this run:'}
<StepSelectionDescription selection={selectionOfCurrentRun} />
<StepSelectionDescription selection={currentRunSelection} />
</div>
),
onClick: () => onLaunch({type: 'selection', selection: selectionOfCurrentRun!}),
onClick: () => onLaunch({type: 'selection', selection: currentRunSelection!}),
};

const selected: LaunchButtonConfiguration = {
Expand Down Expand Up @@ -209,9 +212,12 @@ export const RunActionButtons: React.FC<RunActionButtonsProps> = (props) => {
const options = [full, same, selected, fromSelected, fromFailure];
const preferredRerun = selection.present
? selected
: selectionOfCurrentRun?.present
: fromFailureEnabled && currentRunIsFromFailure
? fromFailure
: currentRunSelection?.present
? same
: null;

const primary = artifactsPersisted && preferredRerun ? preferredRerun : full;

const tooltip = () => {
Expand All @@ -228,7 +234,13 @@ export const RunActionButtons: React.FC<RunActionButtonsProps> = (props) => {
runCount={1}
primary={primary}
options={options}
title={primary.scope === '*' ? `Re-execute All (*)` : `Re-execute (${primary.scope})`}
title={
primary.scope === '*'
? `Re-execute All (*)`
: primary.scope
? `Re-execute (${primary.scope})`
: `Re-execute ${primary.title}`
}
tooltip={tooltip()}
icon={pipelineError?.icon}
disabled={pipelineError?.disabled || !canLaunchPipelineReexecution}
Expand Down

0 comments on commit 8f271ef

Please sign in to comment.