How to use the @terascope/job-components.validateJobConfig function in @terascope/job-components

To help you get started, we’ve selected a few @terascope/job-components examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github terascope / teraslice / packages / teraslice-op-test-harness / index.js View on Github external
getProcessor(_opConfig, extraContext) {
        let opConfig = _opConfig;
        if (_opConfig == null) {
            opConfig = {};
        }

        if (!opConfig._op) {
            opConfig._op = 'test-op-name';
        }
        const operation = this.operationFn;
        const { schema, context } = this;
        // run the jobConfig and opConfig through the validator to get
        // complete and convict validated configs
        const jobConfig = validateJobConfig(schema, { operations: [{ _op: 'noop' }, opConfig] });
        return operation.newProcessor(
            _.assign({}, context, extraContext),
            validateOpConfig(operation.schema(), opConfig),
            jobConfig
        );
    }
github terascope / teraslice / packages / teraslice-op-test-harness / index.js View on Github external
opConfig = schema.validate(newOpConfig || exConfig.operations[0]);
            if (isProcessor) {
                exConfig.operations = [{ _op: 'test-reader' }, opConfig];
            } else {
                exConfig.operations = [opConfig, { _op: 'noop' }];
            }
        } else {
            const opPosition = isProcessor ? 1 : 0;
            opConfig = schema.validate(newOpConfig || exConfig.operations[opPosition]);

            exConfig.operations[opPosition] = opConfig;
        }

        this.opConfig = opConfig;

        const executionConfig = validateJobConfig(this.schema, exConfig);
        schema.validateJob(executionConfig);

        this.executionConfig = executionConfig;
        this.retryData = retryData;

        if (clients) {
            this.setClients(clients);
        }
        const instance = new Operation({
            op,
            context,
            opConfig,
            logger,
            retryData,
            executionConfig,
            type
github terascope / teraslice / packages / teraslice-test-harness / src / job-harness.ts View on Github external
constructor(job: JobConfig, options: JobHarnessOptions) {
        const context = new TestContext(`job-harness:${job.name}`);
        context.assignment = options.assignment || Assignment.Worker;

        const jobSchema = makeJobSchema(context);
        const executionConfig = validateJobConfig(jobSchema, job) as ExecutionConfig;
        this.context = makeExecutionContext({
            context,
            executionConfig
        });
    }