Skip to content

Commit

Permalink
build: Execution of experiments will now show a link to the ui.
Browse files Browse the repository at this point in the history
  • Loading branch information
ReuDa committed Dec 30, 2024
1 parent b01bf62 commit fd2bcf8
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Changelog

## v4.2.5 (next release)
## v4.2.5
- `advice validate-status` - parameter `query` is now optional
- Execution of experiments will now show a link to the ui.

## v4.2.4
- Removed unnecessary dependency
Expand Down
9 changes: 8 additions & 1 deletion src/experiment/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,14 @@ export async function executeExperiment(key: string): Promise<ExecuteResult> {
method: 'POST',
path: `/api/experiments/${encodeURIComponent(key)}/execute`,
});
return { location: response.headers.get('Location') ?? '' };

let uiLocation = 'please update your platform to get the UI location';
const body = await response.text();
if (body && body.length > 0) {
const json = JSON.parse(body);
uiLocation = json.uiLocation;
}
return { location: response.headers.get('Location') ?? '', uiLocation };
} catch (e) {
throw await abortExecutionWithError(e, 'Failed to run experiment %s (%s@%s)', key);
}
Expand Down
6 changes: 4 additions & 2 deletions src/experiment/exec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,15 @@ export async function executeExperiments(options: Options) {
}

console.log('Executing experiment:', key);
console.log('Experiment run:', result.location);
console.log('Experiment run API:', result.location);
console.log('Experiment run UI:', result.uiLocation);
/* eslint-disable @typescript-eslint/no-unused-expressions */
options.wait && result.location && (await waitFor(result.location));
}
} else if (options.key) {
const result = await api.executeExperiment(options.key);
console.log('Experiment run:', result.location);
console.log('Experiment run API:', result.location);
console.log('Experiment run UI:', result.uiLocation);
console.log('Executing experiment:', options.key);
/* eslint-disable @typescript-eslint/no-unused-expressions */
options.wait && result.location && (await waitFor(result.location));
Expand Down
1 change: 1 addition & 0 deletions src/experiment/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

export type ExecuteResult = {
location?: string;
uiLocation?: string;
};

export type ExecutionResult = {
Expand Down

0 comments on commit fd2bcf8

Please sign in to comment.