Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// used for testing so we dont have to pollute the process env in testing
const {
processAssignment = context.__test_assignment || process.env.assignment,
execution = _parseJob(context.__test_job || process.env.job),
} = config;
const isSlicer = processAssignment === 'execution_controller';
const assetPath = execution.assets ? context.sysconfig.teraslice.assets_directory : null;
const jobAssets = execution.assets ? execution.assets : [];
const opLoader = new OperationLoader({
assetPath,
terasliceOpPath: path.join(__dirname, '..', '..'),
});
registerApis(context, execution);
function _instantiateJob() {
let slicer = null;
const reporter = null;
let queue = [];
if (context.sysconfig.teraslice.reporter) {
throw new Error('reporters are not functional at this time, please do not set one in the configuration');
}
// TODO fix released api
function executionApi() {
return {
reader: queue[0],
queue,
config: execution,
reporter,
constructor({
op,
context,
opConfig,
logger,
retryData,
executionConfig,
type
}) {
this.operationFn = op;
this.context = context;
this.logger = logger;
this.retryData = retryData;
this.executionConfig = executionConfig;
this.opConfig = opConfig;
registerApis(context, executionConfig);
this.isProcessor = op.Processor || (op.newProcessor !== undefined);
this.isReader = op.Fetcher || (type === 'reader' && op.newReader !== undefined);
this.isSlicer = op.Slicer || (type === 'slicer' && op.newSlicer !== undefined);
this._hasInit = false;
bindThis(this, Operation);
}