Skip to content

Commit

Permalink
feat: Bump WsWorkunits services
Browse files Browse the repository at this point in the history
Signed-off-by: Gordon Smith<GordonJSmith@gmail.com>
  • Loading branch information
GordonSmith committed Apr 17, 2024
1 parent cb43747 commit 9ee2210
Show file tree
Hide file tree
Showing 23 changed files with 9,896 additions and 2,945 deletions.
143 changes: 72 additions & 71 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 15 additions & 1 deletion packages/comms/.vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "WSDL Generation",
"request": "launch",
"runtimeArgs": [
"run-script",
"wsdl-workunits"
],
"runtimeExecutable": "npm",
"skipFiles": [
"<node_internals>/**"
],
"type": "node",
"sourceMaps": true
},
{
"name": "index.html",
"type": "msedge",
Expand All @@ -16,7 +30,7 @@
},
{
"name": "Mocha Tests",
"type": "pwa-node",
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/../../node_modules/mocha/bin/_mocha",
"args": [
Expand Down
7 changes: 4 additions & 3 deletions packages/comms/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
"compile-es6-watch": "npm run compile-es6 -- -w",
"compile-umd": "tsc --module umd --outDir ./lib-umd",
"compile-umd-watch": "npm run compile-umd -- -w",
"compile-util": "tsc --esModuleInterop --target es2019 --skipLibCheck --module commonjs --outDir ./lib-cjs ./utils/index.ts",
"compile-util": "tsc --esModuleInterop --target es2019 --skipLibCheck --module commonjs --sourcemap --outDir ./lib-cjs ./utils/index.ts",
"compile-util-watch": "npm run compile-util -- -w",
"bundle": "rollup -c",
"bundle-watch": "npm run bundle -- -w",
"minimize-browser": "terser dist/index.js -c -m --source-map \"content='dist/index.js.map',url='index.min.js.map'\" -o dist/index.min.js",
Expand Down Expand Up @@ -77,7 +78,7 @@
"@types/xmldom": "0.1.34",
"d3-array": "^1",
"d3-time-format": "^2",
"soap": "0.45.0",
"soap": "1.0.0",
"tslib": "2.6.2",
"typescript-formatter": "^7.2.2",
"whatwg-fetch": "3.6.20"
Expand All @@ -93,4 +94,4 @@
"url": "https://github.com/hpcc-systems/Visualization/issues"
},
"homepage": "https://github.com/hpcc-systems/Visualization"
}
}
2 changes: 1 addition & 1 deletion packages/comms/src/__tests__/workunit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe("Workunit", () => {
it("ping", async () => {
const service = new WorkunitsService(connection);
const pingResponse = await service.Ping();
expect(pingResponse.result).to.be.true;
expect(pingResponse).to.exist;
});

it.skip("query", async () => {
Expand Down
9 changes: 7 additions & 2 deletions packages/comms/src/ecl/dfuWorkunit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,12 @@ export class DFUWorkunit extends StateObject<UDFUWorkunitState, IDFUWorkunitStat
}

delete() {
return this.DFUWUAction(FileSpray.DFUWUActions.Delete);
return this.DFUWUAction(FileSpray.DFUWUActions.Delete).then(response => {
return this.refresh().then(() => {
this._monitor();
return response;
});
});
}

async refresh(full: boolean = false): Promise<this> {
Expand Down Expand Up @@ -342,7 +347,7 @@ export class DFUWorkunit extends StateObject<UDFUWorkunitState, IDFUWorkunitStat
}).catch((e: ESPExceptions) => {
// deleted ---
const wuMissing = e.Exception.some((exception) => {
if (exception.Code === 20081) {
if (exception.Code === 20080 || exception.Code === 20081) {
this.clearState(this.ID);
this.set("State", States.NotFound);
return true;
Expand Down
8 changes: 4 additions & 4 deletions packages/comms/src/ecl/graph.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Cache, Edge, Graph, StateObject, StringAnyMap, Subgraph, Vertex, XMLNode } from "@hpcc-js/util";
import { WUInfo } from "../services/wsWorkunits";
import { WsWorkunits } from "../services/wsWorkunits";
import { BaseScope } from "./scope";
import { Timer } from "./timer";
import { Workunit } from "./workunit";

export interface ECLGraphEx extends WUInfo.ECLGraph {
export interface ECLGraphEx extends WsWorkunits.ECLGraph {
Time: number;
}

Expand All @@ -23,7 +23,7 @@ export class ECLGraph extends StateObject<ECLGraphEx, ECLGraphEx> implements ECL
get RunningId(): number { return this.get("RunningId"); }
get Failed(): boolean { return this.get("Failed"); }

constructor(wu: Workunit, eclGraph: WUInfo.ECLGraph, eclTimers: Timer[]) {
constructor(wu: Workunit, eclGraph: WsWorkunits.ECLGraph, eclTimers: Timer[]) {
super();
this.wu = wu;
let duration = 0;
Expand All @@ -48,7 +48,7 @@ export class ECLGraph extends StateObject<ECLGraphEx, ECLGraphEx> implements ECL
}
}

export class GraphCache extends Cache<WUInfo.ECLGraph, ECLGraph> {
export class GraphCache extends Cache<WsWorkunits.ECLGraph, ECLGraph> {
constructor() {
super((obj) => {
return Cache.hash([obj.Name]);
Expand Down
33 changes: 17 additions & 16 deletions packages/comms/src/ecl/query.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Cache, StateObject, scopedLogger } from "@hpcc-js/util";
import { Cache, StateObject, scopedLogger, RecursivePartial } from "@hpcc-js/util";
import { format as d3Format } from "d3-format";
import { IConnection, IOptions } from "../connection";
import { EclService, IWsEclRequest, IWsEclResponse, IWsEclResult } from "../services/wsEcl";
import { WorkunitsService, WUDetails, WUQueryDetails, WUDetailsMeta } from "../services/wsWorkunits";
import { WorkunitsService, WsWorkunits } from "../services/wsWorkunits";
import { Topology } from "./topology";
import { Workunit, IScope } from "./workunit";
import { QueryGraph } from "./queryGraph";
Expand All @@ -16,7 +16,7 @@ const siFormatter = d3Format("~s");
function isNumber(n) {
return !isNaN(parseFloat(n)) && !isNaN(n - 0);
}
export interface QueryEx extends WUQueryDetails.Response {
export interface QueryEx extends WsWorkunits.WUQueryDetailsResponse {
BaseUrl: string;
}

Expand All @@ -36,8 +36,8 @@ export class Query extends StateObject<QueryEx, QueryEx> implements QueryEx {
protected _requestSchema: IWsEclRequest;
protected _responseSchema: IWsEclResponse;

get properties(): WUQueryDetails.Response { return this.get(); }
get Exceptions(): WUQueryDetails.Exceptions { return this.get("Exceptions"); }
get properties(): WsWorkunits.WUQueryDetailsResponse { return this.get(); }
get Exceptions(): WsWorkunits.Exceptions { return this.get("Exceptions"); }
get QueryId(): string { return this.get("QueryId"); }
get QuerySet(): string { return this.get("QuerySet"); }
get QueryName(): string { return this.get("QueryName"); }
Expand All @@ -46,23 +46,24 @@ export class Query extends StateObject<QueryEx, QueryEx> implements QueryEx {
get Suspended(): boolean { return this.get("Suspended"); }
get Activated(): boolean { return this.get("Activated"); }
get SuspendedBy(): string { return this.get("SuspendedBy"); }
get Clusters(): WUQueryDetails.Clusters { return this.get("Clusters"); }
get Clusters(): WsWorkunits.Clusters2 { return this.get("Clusters"); }
get PublishedBy(): string { return this.get("PublishedBy"); }
get Comment() { return this.get("Comment"); }
get LogicalFiles(): WUQueryDetails.LogicalFiles { return this.get("LogicalFiles"); }
get SuperFiles(): WUQueryDetails.SuperFiles { return this.get("SuperFiles"); }
get LogicalFiles(): WsWorkunits.LogicalFiles { return this.get("LogicalFiles"); }
get SuperFiles(): WsWorkunits.SuperFiles { return this.get("SuperFiles"); }
get IsLibrary(): boolean { return this.get("IsLibrary"); }
get Priority(): string { return this.get("Priority"); }
get WUSnapShot(): string { return this.get("WUSnapShot"); }
get CompileTime(): string { return this.get("CompileTime"); }
get LibrariesUsed(): WUQueryDetails.LibrariesUsed { return this.get("LibrariesUsed"); }
get LibrariesUsed(): WsWorkunits.LibrariesUsed { return this.get("LibrariesUsed"); }
get CountGraphs(): number { return this.get("CountGraphs"); }
get ResourceURLCount(): number { return this.get("ResourceURLCount"); }
get WsEclAddresses(): WUQueryDetails.WsEclAddresses { return this.get("WsEclAddresses"); }
get WUGraphs(): WUQueryDetails.WUGraphs { return this.get("WUGraphs"); }
get WUTimers(): WUQueryDetails.WUTimers { return this.get("WUTimers"); }
get WsEclAddresses(): WsWorkunits.WsEclAddresses { return this.get("WsEclAddresses"); }
get WUGraphs(): WsWorkunits.WUGraphs { return this.get("WUGraphs"); }
get WUTimers(): WsWorkunits.WUTimers { return this.get("WUTimers"); }
get PriorityID(): number { return this.get("PriorityID"); }

private constructor(optsConnection: IOptions | IConnection | WorkunitsService, querySet: string, queryID: string, queryDetails?: WUQueryDetails.Response) {
private constructor(optsConnection: IOptions | IConnection | WorkunitsService, querySet: string, queryID: string, queryDetails?: WsWorkunits.WUQueryDetailsResponse) {
super();
if (optsConnection instanceof WorkunitsService) {
this.wsWorkunitsService = optsConnection;
Expand Down Expand Up @@ -160,13 +161,13 @@ export class Query extends StateObject<QueryEx, QueryEx> implements QueryEx {
});
}

fetchDetailsNormalized(request: Partial<WUDetails.Request> = {}): Promise<{ meta: WUDetailsMeta.Response | undefined, columns: { [id: string]: any } | undefined, data: IScope[] | undefined }> {
fetchDetailsNormalized(request: RecursivePartial<WsWorkunits.WUDetails> = {}): Promise<{ meta: WsWorkunits.WUDetailsMetaResponse | undefined, columns: { [id: string]: any } | undefined, data: IScope[] | undefined }> {
const wu = Workunit.attach(this.wsWorkunitsService, this.Wuid);
if (wu) {
return Promise.all([this.fetchGraph(), wu.fetchDetailsMeta(), wu.fetchDetailsRaw(request)]).then(promises => {
const graph = promises[0];
const meta = promises[1];
const metrics: WUDetails.Scope[] = promises[2];
const metrics: WsWorkunits.Scope[] = promises[2];
const data = metrics.map(metric => {
if (metric.Id[0] === "a" || metric.Id[0] === "e") {
const item = graph.idx[metric.Id.substring(1)];
Expand All @@ -185,7 +186,7 @@ export class Query extends StateObject<QueryEx, QueryEx> implements QueryEx {
Name: key,
RawValue: rawValue,
Formatted: formatted
} as WUDetails.Property);
} as WsWorkunits.Property);
}
}
}
Expand Down
Loading

0 comments on commit 9ee2210

Please sign in to comment.