Skip to content

Commit 2152622

Browse files
octogonzbartvandenende-wm
authored andcommitted
Require IOperationOptions.name
1 parent ca6e96b commit 2152622

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

apps/heft/src/cli/HeftActionRunner.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,7 @@ function _getOrCreatePhaseOperation(
447447
// Only create the operation. Dependencies are hooked up separately
448448
operation = new Operation({
449449
groupName: phase.phaseName,
450+
name: `${phase.phaseName} phase`,
450451
runner: new PhaseOperationRunner({ phase, internalHeftSession })
451452
});
452453
operations.set(key, operation);
@@ -466,6 +467,7 @@ function _getOrCreateTaskOperation(
466467
if (!operation) {
467468
operation = new Operation({
468469
groupName: task.parentPhase.phaseName,
470+
name: `${task.taskName} task`,
469471
runner: new TaskOperationRunner({
470472
internalHeftSession,
471473
task

common/reviews/api/operation-graph.api.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export interface IOperationExecutionOptions {
5858
// @beta
5959
export interface IOperationOptions {
6060
groupName?: string | undefined;
61-
name?: string | undefined;
61+
name: string;
6262
runner?: IOperationRunner | undefined;
6363
weight?: number | undefined;
6464
}
@@ -140,7 +140,7 @@ export interface IWatchLoopState {
140140

141141
// @beta
142142
export class Operation implements IOperationStates {
143-
constructor(options?: IOperationOptions);
143+
constructor(options: IOperationOptions);
144144
// (undocumented)
145145
addDependency(dependency: Operation): void;
146146
readonly consumers: Set<Operation>;
@@ -152,7 +152,7 @@ export class Operation implements IOperationStates {
152152
_executeAsync(context: IExecuteOperationContext): Promise<OperationStatus>;
153153
readonly groupName: string | undefined;
154154
lastState: IOperationState | undefined;
155-
readonly name: string | undefined;
155+
readonly name: string;
156156
// (undocumented)
157157
reset(): void;
158158
runner: IOperationRunner | undefined;

libraries/operation-graph/src/Operation.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export interface IOperationOptions {
2222
/**
2323
* The name of this operation, for logging.
2424
*/
25-
name?: string | undefined;
25+
name: string;
2626

2727
/**
2828
* The group that this operation belongs to. Will be used for logging and duration tracking.
@@ -101,7 +101,7 @@ export class Operation implements IOperationStates {
101101
/**
102102
* The name of this operation, for logging.
103103
*/
104-
public readonly name: string | undefined;
104+
public readonly name: string;
105105

106106
/**
107107
* When the scheduler is ready to process this `Operation`, the `runner` implements the actual work of
@@ -174,11 +174,11 @@ export class Operation implements IOperationStates {
174174
*/
175175
private _runPending: boolean = true;
176176

177-
public constructor(options?: IOperationOptions) {
177+
public constructor(options: IOperationOptions) {
178178
this.groupName = options?.groupName;
179179
this.runner = options?.runner;
180180
this.weight = options?.weight || 1;
181-
this.name = options?.name;
181+
this.name = options.name;
182182
}
183183

184184
public addDependency(dependency: Operation): void {

0 commit comments

Comments
 (0)