Skip to content

Commit

Permalink
progres
Browse files Browse the repository at this point in the history
  • Loading branch information
coltmcnealy-lh committed Feb 5, 2024
1 parent 76b1d82 commit 2ec2cb1
Show file tree
Hide file tree
Showing 32 changed files with 2,294 additions and 1,631 deletions.
37 changes: 0 additions & 37 deletions dashboard/apps/web/littlehorse-public-api/common_enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -516,40 +516,3 @@ export function lHErrorTypeToNumber(object: LHErrorType): number {
return -1;
}
}

export enum WaitForThreadsPolicy {
STOP_ON_FAILURE = "STOP_ON_FAILURE",
UNRECOGNIZED = "UNRECOGNIZED",
}

export function waitForThreadsPolicyFromJSON(object: any): WaitForThreadsPolicy {
switch (object) {
case 0:
case "STOP_ON_FAILURE":
return WaitForThreadsPolicy.STOP_ON_FAILURE;
case -1:
case "UNRECOGNIZED":
default:
return WaitForThreadsPolicy.UNRECOGNIZED;
}
}

export function waitForThreadsPolicyToJSON(object: WaitForThreadsPolicy): string {
switch (object) {
case WaitForThreadsPolicy.STOP_ON_FAILURE:
return "STOP_ON_FAILURE";
case WaitForThreadsPolicy.UNRECOGNIZED:
default:
return "UNRECOGNIZED";
}
}

export function waitForThreadsPolicyToNumber(object: WaitForThreadsPolicy): number {
switch (object) {
case WaitForThreadsPolicy.STOP_ON_FAILURE:
return 0;
case WaitForThreadsPolicy.UNRECOGNIZED:
default:
return -1;
}
}
33 changes: 2 additions & 31 deletions dashboard/apps/web/littlehorse-public-api/node_run.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
/* eslint-disable */
import * as _m0 from "protobufjs/minimal";
import {
LHStatus,
lHStatusFromJSON,
lHStatusToJSON,
lHStatusToNumber,
WaitForThreadsPolicy,
waitForThreadsPolicyFromJSON,
waitForThreadsPolicyToJSON,
waitForThreadsPolicyToNumber,
} from "./common_enums";
import { LHStatus, lHStatusFromJSON, lHStatusToJSON, lHStatusToNumber } from "./common_enums";
import { Timestamp } from "./google/protobuf/timestamp";
import { ExternalEventDefId, ExternalEventId, NodeRunId, TaskRunId, UserTaskRunId, WfSpecId } from "./object_id";
import { VariableValue } from "./variable";
Expand Down Expand Up @@ -157,11 +148,6 @@ export interface StartMultipleThreadsRun {
export interface WaitForThreadsRun {
/** The threads that are being waited for. */
threads: WaitForThreadsRun_WaitForThread[];
/**
* The policy to use when handling failures for Threads. Currently, only
* one policy exists.
*/
policy: WaitForThreadsPolicy;
}

/** A 'WaitForThread' structure defines a thread that is being waited for. */
Expand Down Expand Up @@ -949,17 +935,14 @@ export const StartMultipleThreadsRun = {
};

function createBaseWaitForThreadsRun(): WaitForThreadsRun {
return { threads: [], policy: WaitForThreadsPolicy.STOP_ON_FAILURE };
return { threads: [] };
}

export const WaitForThreadsRun = {
encode(message: WaitForThreadsRun, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
for (const v of message.threads) {
WaitForThreadsRun_WaitForThread.encode(v!, writer.uint32(10).fork()).ldelim();
}
if (message.policy !== WaitForThreadsPolicy.STOP_ON_FAILURE) {
writer.uint32(16).int32(waitForThreadsPolicyToNumber(message.policy));
}
return writer;
},

Expand All @@ -977,13 +960,6 @@ export const WaitForThreadsRun = {

message.threads.push(WaitForThreadsRun_WaitForThread.decode(reader, reader.uint32()));
continue;
case 2:
if (tag !== 16) {
break;
}

message.policy = waitForThreadsPolicyFromJSON(reader.int32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
Expand All @@ -998,7 +974,6 @@ export const WaitForThreadsRun = {
threads: globalThis.Array.isArray(object?.threads)
? object.threads.map((e: any) => WaitForThreadsRun_WaitForThread.fromJSON(e))
: [],
policy: isSet(object.policy) ? waitForThreadsPolicyFromJSON(object.policy) : WaitForThreadsPolicy.STOP_ON_FAILURE,
};
},

Expand All @@ -1007,9 +982,6 @@ export const WaitForThreadsRun = {
if (message.threads?.length) {
obj.threads = message.threads.map((e) => WaitForThreadsRun_WaitForThread.toJSON(e));
}
if (message.policy !== WaitForThreadsPolicy.STOP_ON_FAILURE) {
obj.policy = waitForThreadsPolicyToJSON(message.policy);
}
return obj;
},

Expand All @@ -1019,7 +991,6 @@ export const WaitForThreadsRun = {
fromPartial<I extends Exact<DeepPartial<WaitForThreadsRun>, I>>(object: I): WaitForThreadsRun {
const message = createBaseWaitForThreadsRun();
message.threads = object.threads?.map((e) => WaitForThreadsRun_WaitForThread.fromPartial(e)) || [];
message.policy = object.policy ?? WaitForThreadsPolicy.STOP_ON_FAILURE;
return message;
},
};
Expand Down
128 changes: 96 additions & 32 deletions dashboard/apps/web/littlehorse-public-api/wf_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ import {
variableTypeFromJSON,
variableTypeToJSON,
variableTypeToNumber,
WaitForThreadsPolicy,
waitForThreadsPolicyFromJSON,
waitForThreadsPolicyToJSON,
waitForThreadsPolicyToNumber,
} from "./common_enums";
import {
Comparator,
Expand Down Expand Up @@ -251,19 +247,19 @@ export function failureHandlerDef_LHFailureTypeToNumber(object: FailureHandlerDe
}

export interface WaitForThreadsNode {
/**
* Either 1 or 3 is set. Cannot put `repeated` into a oneof, and
* for compatibility reasons, we cannot wrap it into a separate message.
*/
threads: WaitForThreadsNode_ThreadToWaitFor[];
threads?: WaitForThreadsNode_ThreadsToWaitFor | undefined;
threadList?: VariableAssignment | undefined;
policy: WaitForThreadsPolicy;
perThreadFailureHandlers: FailureHandlerDef[];
}

export interface WaitForThreadsNode_ThreadToWaitFor {
threadRunNumber: VariableAssignment | undefined;
}

export interface WaitForThreadsNode_ThreadsToWaitFor {
threads: WaitForThreadsNode_ThreadToWaitFor[];
}

export interface ExternalEventNode {
externalEventDefId: ExternalEventDefId | undefined;
timeoutSeconds: VariableAssignment | undefined;
Expand Down Expand Up @@ -1867,19 +1863,19 @@ export const FailureHandlerDef = {
};

function createBaseWaitForThreadsNode(): WaitForThreadsNode {
return { threads: [], threadList: undefined, policy: WaitForThreadsPolicy.STOP_ON_FAILURE };
return { threads: undefined, threadList: undefined, perThreadFailureHandlers: [] };
}

export const WaitForThreadsNode = {
encode(message: WaitForThreadsNode, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
for (const v of message.threads) {
WaitForThreadsNode_ThreadToWaitFor.encode(v!, writer.uint32(10).fork()).ldelim();
if (message.threads !== undefined) {
WaitForThreadsNode_ThreadsToWaitFor.encode(message.threads, writer.uint32(10).fork()).ldelim();
}
if (message.threadList !== undefined) {
VariableAssignment.encode(message.threadList, writer.uint32(26).fork()).ldelim();
VariableAssignment.encode(message.threadList, writer.uint32(18).fork()).ldelim();
}
if (message.policy !== WaitForThreadsPolicy.STOP_ON_FAILURE) {
writer.uint32(16).int32(waitForThreadsPolicyToNumber(message.policy));
for (const v of message.perThreadFailureHandlers) {
FailureHandlerDef.encode(v!, writer.uint32(26).fork()).ldelim();
}
return writer;
},
Expand All @@ -1896,21 +1892,21 @@ export const WaitForThreadsNode = {
break;
}

message.threads.push(WaitForThreadsNode_ThreadToWaitFor.decode(reader, reader.uint32()));
message.threads = WaitForThreadsNode_ThreadsToWaitFor.decode(reader, reader.uint32());
continue;
case 3:
if (tag !== 26) {
case 2:
if (tag !== 18) {
break;
}

message.threadList = VariableAssignment.decode(reader, reader.uint32());
continue;
case 2:
if (tag !== 16) {
case 3:
if (tag !== 26) {
break;
}

message.policy = waitForThreadsPolicyFromJSON(reader.int32());
message.perThreadFailureHandlers.push(FailureHandlerDef.decode(reader, reader.uint32()));
continue;
}
if ((tag & 7) === 4 || tag === 0) {
Expand All @@ -1923,24 +1919,24 @@ export const WaitForThreadsNode = {

fromJSON(object: any): WaitForThreadsNode {
return {
threads: globalThis.Array.isArray(object?.threads)
? object.threads.map((e: any) => WaitForThreadsNode_ThreadToWaitFor.fromJSON(e))
: [],
threads: isSet(object.threads) ? WaitForThreadsNode_ThreadsToWaitFor.fromJSON(object.threads) : undefined,
threadList: isSet(object.threadList) ? VariableAssignment.fromJSON(object.threadList) : undefined,
policy: isSet(object.policy) ? waitForThreadsPolicyFromJSON(object.policy) : WaitForThreadsPolicy.STOP_ON_FAILURE,
perThreadFailureHandlers: globalThis.Array.isArray(object?.perThreadFailureHandlers)
? object.perThreadFailureHandlers.map((e: any) => FailureHandlerDef.fromJSON(e))
: [],
};
},

toJSON(message: WaitForThreadsNode): unknown {
const obj: any = {};
if (message.threads?.length) {
obj.threads = message.threads.map((e) => WaitForThreadsNode_ThreadToWaitFor.toJSON(e));
if (message.threads !== undefined) {
obj.threads = WaitForThreadsNode_ThreadsToWaitFor.toJSON(message.threads);
}
if (message.threadList !== undefined) {
obj.threadList = VariableAssignment.toJSON(message.threadList);
}
if (message.policy !== WaitForThreadsPolicy.STOP_ON_FAILURE) {
obj.policy = waitForThreadsPolicyToJSON(message.policy);
if (message.perThreadFailureHandlers?.length) {
obj.perThreadFailureHandlers = message.perThreadFailureHandlers.map((e) => FailureHandlerDef.toJSON(e));
}
return obj;
},
Expand All @@ -1950,11 +1946,14 @@ export const WaitForThreadsNode = {
},
fromPartial<I extends Exact<DeepPartial<WaitForThreadsNode>, I>>(object: I): WaitForThreadsNode {
const message = createBaseWaitForThreadsNode();
message.threads = object.threads?.map((e) => WaitForThreadsNode_ThreadToWaitFor.fromPartial(e)) || [];
message.threads = (object.threads !== undefined && object.threads !== null)
? WaitForThreadsNode_ThreadsToWaitFor.fromPartial(object.threads)
: undefined;
message.threadList = (object.threadList !== undefined && object.threadList !== null)
? VariableAssignment.fromPartial(object.threadList)
: undefined;
message.policy = object.policy ?? WaitForThreadsPolicy.STOP_ON_FAILURE;
message.perThreadFailureHandlers = object.perThreadFailureHandlers?.map((e) => FailureHandlerDef.fromPartial(e)) ||
[];
return message;
},
};
Expand Down Expand Up @@ -2024,6 +2023,71 @@ export const WaitForThreadsNode_ThreadToWaitFor = {
},
};

function createBaseWaitForThreadsNode_ThreadsToWaitFor(): WaitForThreadsNode_ThreadsToWaitFor {
return { threads: [] };
}

export const WaitForThreadsNode_ThreadsToWaitFor = {
encode(message: WaitForThreadsNode_ThreadsToWaitFor, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
for (const v of message.threads) {
WaitForThreadsNode_ThreadToWaitFor.encode(v!, writer.uint32(10).fork()).ldelim();
}
return writer;
},

decode(input: _m0.Reader | Uint8Array, length?: number): WaitForThreadsNode_ThreadsToWaitFor {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseWaitForThreadsNode_ThreadsToWaitFor();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}

message.threads.push(WaitForThreadsNode_ThreadToWaitFor.decode(reader, reader.uint32()));
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},

fromJSON(object: any): WaitForThreadsNode_ThreadsToWaitFor {
return {
threads: globalThis.Array.isArray(object?.threads)
? object.threads.map((e: any) => WaitForThreadsNode_ThreadToWaitFor.fromJSON(e))
: [],
};
},

toJSON(message: WaitForThreadsNode_ThreadsToWaitFor): unknown {
const obj: any = {};
if (message.threads?.length) {
obj.threads = message.threads.map((e) => WaitForThreadsNode_ThreadToWaitFor.toJSON(e));
}
return obj;
},

create<I extends Exact<DeepPartial<WaitForThreadsNode_ThreadsToWaitFor>, I>>(
base?: I,
): WaitForThreadsNode_ThreadsToWaitFor {
return WaitForThreadsNode_ThreadsToWaitFor.fromPartial(base ?? ({} as any));
},
fromPartial<I extends Exact<DeepPartial<WaitForThreadsNode_ThreadsToWaitFor>, I>>(
object: I,
): WaitForThreadsNode_ThreadsToWaitFor {
const message = createBaseWaitForThreadsNode_ThreadsToWaitFor();
message.threads = object.threads?.map((e) => WaitForThreadsNode_ThreadToWaitFor.fromPartial(e)) || [];
return message;
},
};

function createBaseExternalEventNode(): ExternalEventNode {
return { externalEventDefId: undefined, timeoutSeconds: undefined };
}
Expand Down
4 changes: 0 additions & 4 deletions schemas/common_enums.proto
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,3 @@ enum LHErrorType {
// An unexpected LittleHorse Internal error occurred. This is not expected to happen.
INTERNAL_ERROR = 8;
}

enum WaitForThreadsPolicy{
STOP_ON_FAILURE = 0;
}
4 changes: 0 additions & 4 deletions schemas/node_run.proto
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,6 @@ message WaitForThreadsRun {

// The threads that are being waited for.
repeated WaitForThread threads = 1;

// The policy to use when handling failures for Threads. Currently, only
// one policy exists.
WaitForThreadsPolicy policy = 2;
}

// The sub-node structure for an EXTERNAL_EVENT NodeRun.
Expand Down
Loading

0 comments on commit 2ec2cb1

Please sign in to comment.