@prefecthq/prefect-ui-library
Version:
This library is the Vue and Typescript component library for [Prefect 2](https://github.com/PrefectHQ/prefect) and [Prefect Cloud 2](https://www.prefect.io/cloud/). _The components and utilities in this project are not meant to be used independently_.
34 lines (33 loc) • 1.25 kB
text/typescript
import { TaskRun } from '@/models/TaskRun'
import { MockFunction } from '@/services/Mocker'
export const randomTaskRun: MockFunction<TaskRun, [Partial<TaskRun>?]> = function(overrides = {}) {
const state = this.create('state')
return new TaskRun({
id: this.create('id'),
flowRunId: this.create('boolean') ? this.create('id') : null,
cacheExpiration: this.create('string'),
cacheKey: this.create('string'),
created: this.create('date'),
dynamicKey: this.create('string'),
empiricalPolicy: null,
estimatedRunTime: this.create('number'),
estimatedStartTimeDelta: this.create('number'),
totalRunTime: this.create('number'),
expectedStartTime: this.create('date'),
nextScheduledStartTime: this.create('boolean') ? this.create('date') : null,
runCount: this.create('number'),
name: this.create('runName'),
taskInputs: {},
taskKey: this.create('string'),
taskVersion: this.create('string'),
updated: this.create('date'),
startTime: this.create('date'),
endTime: this.create('date'),
stateId: state.id,
stateType: state.type,
stateName: state.name,
state: state,
tags: this.createMany('noun', this.create('number', [0, 10])),
...overrides,
})
}