Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/candidate-9.8.x'
Browse files Browse the repository at this point in the history
Signed-off-by: Gordon Smith <[email protected]>
  • Loading branch information
GordonSmith committed Oct 24, 2024
2 parents 2f4388d + 5f963f1 commit 3715af2
Show file tree
Hide file tree
Showing 11 changed files with 150 additions and 99 deletions.
18 changes: 15 additions & 3 deletions common/workunit/workunit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3686,7 +3686,8 @@ EnumMapping priorityClasses[] = {

const char * getWorkunitStateStr(WUState state)
{
dbgassertex(state < WUStateSize);
if (state >= WUStateSize)
return "unknown workunit state";
return states[state].str; // MORE - should be using getEnumText, or need to take steps to ensure values remain contiguous and in order.
}

Expand Down Expand Up @@ -14580,11 +14581,22 @@ void executeThorGraph(const char * graphName, IConstWorkUnit &workunit, const IP
}
}

// NB: check for expected success state (WUStateWait). If any other state, abort.
{
Owned<IWorkUnit> w = &workunit.lock();
WUState state = w->getState();
if (WUStateFailed == state)
throw makeStringException(0, "Workunit failed");
if (WUStateWait != state) // expected state from successful Thor run from above
{
switch (state)
{
case WUStateAborting:
throw new WorkflowException(0, "Workunit abort requested", 0, WorkflowException::ABORT, MSGAUD_user);
case WUStateFailed:
throw makeStringException(0, "Workunit failed");
default:
throw makeStringExceptionV(0, "Workunit failed. Unexpected state: %s", getWorkunitStateStr(state));
}
}
w->setState(WUStateRunning);
}
#else
Expand Down
2 changes: 2 additions & 0 deletions esp/src/eclwatch/WUDetailsWidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ define([
"dijit/form/TextBox",
"dijit/Dialog",
"dijit/form/SimpleTextarea",
"dijit/form/DateTextBox",
"dijit/form/TimeTextBox",

"hpcc/TableContainer"
], function (declare, lang, nlsHPCCMod, dom, domAttr, domClass, topic,
Expand Down
2 changes: 1 addition & 1 deletion esp/src/src-react/components/Logs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ export const Logs: React.FunctionComponent<LogsProps> = ({
}
}
const colTypes = logColumns?.map(c => c.LogType.toString()) ?? [];
removeAllExcept(retVal, colTypes);
removeAllExcept(retVal, [...colTypes, "LogLineLimit", "StartDate", "EndDate"]);
return retVal;
}, [filter, logColumns, wuid]);

Expand Down
2 changes: 0 additions & 2 deletions esp/src/src-react/components/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,6 @@ export const SubNavigation: React.FunctionComponent<SubNavigationProps> = ({
React.useEffect(() => {
hasLogAccess().then(response => {
setLogsDisabled(!response);
}).catch(() => {
setLogsDisabled(true);
});
}, []);
const linkStyle = React.useCallback((disabled) => {
Expand Down
41 changes: 28 additions & 13 deletions esp/src/src-react/components/Metrics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { HolyGrail } from "../layouts/HolyGrail";
import { AutosizeComponent, AutosizeHpccJSComponent } from "../layouts/HpccJSAdapter";
import { DockPanel, DockPanelItem, ResetableDockPanel } from "../layouts/DockPanel";
import { LayoutStatus, MetricGraph, MetricGraphWidget, isGraphvizWorkerResponse, layoutCache } from "../util/metricGraph";
import { pushUrl } from "../util/history";
import { pushUrl as _pushUrl } from "../util/history";
import { debounce } from "../util/throttle";
import { ErrorBoundary } from "../util/errorBoundary";
import { ShortVerticalDivider } from "./Common";
Expand Down Expand Up @@ -45,14 +45,16 @@ interface MetricsProps {
queryId?: string;
parentUrl?: string;
selection?: string;
fullscreen?: boolean;
}

export const Metrics: React.FunctionComponent<MetricsProps> = ({
wuid,
querySet = "",
queryId = "",
parentUrl = `/workunits/${wuid}/metrics`,
selection
selection,
fullscreen = false
}) => {
const [_uiState, _setUIState] = React.useState({ ...defaultUIState });
const [selectedMetricsSource, setSelectedMetricsSource] = React.useState<SelectedMetricsSource>("");
Expand All @@ -63,7 +65,6 @@ export const Metrics: React.FunctionComponent<MetricsProps> = ({
const [showMetricOptions, setShowMetricOptions] = React.useState(false);
const [dockpanel, setDockpanel] = React.useState<ResetableDockPanel>();
const [trackSelection, setTrackSelection] = React.useState<boolean>(true);
const [fullscreen, setFullscreen] = React.useState<boolean>(false);
const [hotspots, setHotspots] = React.useState<string>("");
const [lineage, setLineage] = React.useState<IScope[]>([]);
const [selectedLineage, setSelectedLineage] = React.useState<IScope>();
Expand Down Expand Up @@ -96,10 +97,24 @@ export const Metrics: React.FunctionComponent<MetricsProps> = ({
}).catch(err => logger.error(err));
}, [wuid]);

const pushUrl = React.useCallback((selection?: string, fullscreen?: boolean) => {
const selectionStr = selection?.length ? `/${selection}` : "";
const fullscreenStr = fullscreen ? "?fullscreen" : "";
_pushUrl(`${parentUrl}${selectionStr}${fullscreenStr}`);
}, [parentUrl]);

const pushSelectionUrl = React.useCallback((selection: string) => {
pushUrl(selection, fullscreen);
}, [fullscreen, pushUrl]);

const pushFullscreenUrl = React.useCallback((fullscreen: boolean) => {
pushUrl(selection, fullscreen);
}, [pushUrl, selection]);

const onHotspot = React.useCallback(() => {
setSelectedMetricsSource("hotspot");
pushUrl(`${parentUrl}/${selection}`);
}, [parentUrl, selection]);
pushSelectionUrl(selection);
}, [pushSelectionUrl, selection]);

// Timeline ---
const timeline = useConst(() => new WUTimelineNoFetch()
Expand All @@ -114,11 +129,11 @@ export const Metrics: React.FunctionComponent<MetricsProps> = ({
timeline.selection([]);
setSelectedMetricsSource("scopesTable");
setScopeFilter(`name:${row[7].__hpcc_id}`);
pushUrl(`${parentUrl}/${row[7].id}`);
pushSelectionUrl(row[7].id);
}
}, true)
;
}, [parentUrl, timeline]);
}, [pushSelectionUrl, timeline]);

React.useEffect(() => {
if (view.showTimeline) {
Expand All @@ -142,10 +157,10 @@ export const Metrics: React.FunctionComponent<MetricsProps> = ({
.on("selectionChanged", () => {
const selection = metricGraphWidget.selection().filter(id => metricGraph.item(id)).map(id => metricGraph.item(id).id);
setSelectedMetricsSource("metricGraphWidget");
pushUrl(`${parentUrl}/${selection.join(",")}`);
pushSelectionUrl(selection.join(","));
}, true)
;
}, [metricGraph, metricGraphWidget, parentUrl]);
}, [metricGraph, metricGraphWidget, pushSelectionUrl]);

React.useEffect(() => {
metricGraph.load(metrics);
Expand Down Expand Up @@ -301,8 +316,8 @@ export const Metrics: React.FunctionComponent<MetricsProps> = ({

const scopesSelectionChanged = React.useCallback((source: SelectedMetricsSource, selection: IScope[]) => {
setSelectedMetricsSource(source);
pushUrl(`${parentUrl}/${selection.map(row => row.__lparam?.id ?? row.id).join(",")}`);
}, [parentUrl]);
pushSelectionUrl(selection.map(row => row.__lparam?.id ?? row.id).join(","));
}, [pushSelectionUrl]);

const scopesTable = useConst(() => new ScopesTable()
.multiSelect(true)
Expand Down Expand Up @@ -520,9 +535,9 @@ export const Metrics: React.FunctionComponent<MetricsProps> = ({
{ key: "divider_2", itemType: ContextualMenuItemType.Divider, onRender: () => <ShortVerticalDivider /> },
{
key: "fullscreen", title: nlsHPCC.MaximizeRestore, iconProps: { iconName: fullscreen ? "ChromeRestore" : "FullScreen" },
onClick: () => setFullscreen(!fullscreen)
onClick: () => pushFullscreenUrl(!fullscreen)
}
], [dot, formatColumns, fullscreen, metrics, wuid]);
], [dot, formatColumns, fullscreen, metrics, pushFullscreenUrl, wuid]);

const setShowMetricOptionsHook = React.useCallback((show: boolean) => {
setShowMetricOptions(show);
Expand Down
2 changes: 1 addition & 1 deletion esp/src/src-react/components/Queries.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export const Queries: React.FunctionComponent<QueriesProps> = ({
width: 16,
sortable: false,
formatter: (mixed, row) => {
const mixedStates = row.Clusters.ClusterQueryState[0]?.MixedNodeStates ?? false;
const mixedStates = row?.Clusters?.ClusterQueryState[0]?.MixedNodeStates ?? false;
if (mixedStates === true) {
return <Icon iconName="Error" />;
}
Expand Down
9 changes: 3 additions & 6 deletions esp/src/src-react/components/WorkunitDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ interface WorkunitDetailsProps {
parentUrl?: string;
tab?: string;
state?: { outputs?: string, metrics?: string, resources?: string, helpers?: string, eclsummary?: string };
queryParams?: { outputs?: StringStringMap, inputs?: StringStringMap, resources?: StringStringMap, helpers?: StringStringMap, logs?: StringStringMap };
queryParams?: { summary?: StringStringMap, outputs?: StringStringMap, inputs?: StringStringMap, metrics?: StringStringMap, resources?: StringStringMap, helpers?: StringStringMap, logs?: StringStringMap };
}

export const WorkunitDetails: React.FunctionComponent<WorkunitDetailsProps> = ({
Expand Down Expand Up @@ -115,9 +115,6 @@ export const WorkunitDetails: React.FunctionComponent<WorkunitDetailsProps> = ({
hasLogAccess().then(response => {
setLogsDisabled(!response);
return response;
}).catch(err => {
logger.warning(err);
setLogsDisabled(true);
});
}, [wuid], [queryParams]);

Expand Down Expand Up @@ -180,7 +177,7 @@ export const WorkunitDetails: React.FunctionComponent<WorkunitDetailsProps> = ({
<div style={{ height: "100%" }}>
<OverflowTabList tabs={tabs} selected={tab} onTabSelect={onTabSelect} size="medium" />
<DelayLoadedPanel visible={tab === "summary"} size={size}>
<WorkunitSummary wuid={wuid} />
<WorkunitSummary wuid={wuid} fullscreen={queryParams.summary?.fullscreen !== undefined} />
</DelayLoadedPanel>
<DelayLoadedPanel visible={tab === "variables"} size={size}>
<Variables wuid={wuid} />
Expand All @@ -205,7 +202,7 @@ export const WorkunitDetails: React.FunctionComponent<WorkunitDetailsProps> = ({
<Shimmer />
</>
}>
<Metrics wuid={wuid} parentUrl={`${parentUrl}/${wuid}/metrics`} selection={state?.metrics} />
<Metrics wuid={wuid} parentUrl={`${parentUrl}/${wuid}/metrics`} selection={state?.metrics} fullscreen={queryParams.metrics?.fullscreen !== undefined} />
</React.Suspense>
</DelayLoadedPanel>
<DelayLoadedPanel visible={tab === "workflows"} size={size}>
Expand Down
Loading

0 comments on commit 3715af2

Please sign in to comment.