How to use the @terascope/job-components.registerApis 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 / lib / cluster / runners / execution.js View on Github external
// 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,
github terascope / teraslice / packages / teraslice-op-test-harness / lib / operation.js View on Github external
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);
    }