MCPcopy Create free account
hub / github.com/dataform-co/dataform / constructor

Method constructor

cli/api/commands/run.ts:68–105  ·  view source on GitHub ↗
(
    private readonly dbadapter: dbadapters.IDbAdapter,
    private readonly graph: dataform.IExecutionGraph,
    private readonly executionOptions: IExecutionOptions = {},
    partiallyExecutedRunResult: dataform.IRunResult = {},
    private readonly runnerNotificationPeriodMillis: number = flags.runnerNotificationPeriodMillis.get()
  )

Source from the content-addressed store, hash-verified

66 private executionTask: Promise<dataform.IRunResult>;
67
68 constructor(
69 private readonly dbadapter: dbadapters.IDbAdapter,
70 private readonly graph: dataform.IExecutionGraph,
71 private readonly executionOptions: IExecutionOptions = {},
72 partiallyExecutedRunResult: dataform.IRunResult = {},
73 private readonly runnerNotificationPeriodMillis: number = flags.runnerNotificationPeriodMillis.get()
74 ) {
75 this.allActionTargets = new Set<string>(
76 graph.actions.map(action => targetStringifier.stringify(action.target))
77 );
78 this.runResult = {
79 actions: [],
80 ...partiallyExecutedRunResult
81 };
82 this.warehouseStateByTarget = new Map<string, dataform.ITableMetadata>();
83 graph.warehouseState.tables?.forEach(tableMetadata =>
84 this.warehouseStateByTarget.set(
85 targetStringifier.stringify(tableMetadata.target),
86 tableMetadata
87 )
88 );
89 this.executedActionTargets = new Set(
90 this.runResult.actions
91 .filter(action => action.status !== dataform.ActionResult.ExecutionStatus.RUNNING)
92 .map(action => targetStringifier.stringify(action.target))
93 );
94 this.successfullyExecutedActionTargets = new Set<string>(
95 this.runResult.actions
96 .filter(isSuccessfulAction)
97 .map(action => targetStringifier.stringify(action.target))
98 );
99 this.pendingActions = graph.actions.filter(
100 action => !this.executedActionTargets.has(targetStringifier.stringify(action.target))
101 );
102 this.eEmitter = new EventEmitter();
103 // There could feasibly be thousands of listeners to this, 0 makes the limit infinite.
104 this.eEmitter.setMaxListeners(0);
105 }
106
107 public onChange(listener: (graph: dataform.IRunResult) => void): Runner {
108 this.changeListeners.push(listener);

Callers

nothing calls this directly

Calls 3

getMethod · 0.80
stringifyMethod · 0.80
setMethod · 0.45

Tested by

no test coverage detected