Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

externalbackend: refactor #128

Open
dprelipcean opened this issue Sep 9, 2019 · 0 comments
Open

externalbackend: refactor #128

dprelipcean opened this issue Sep 9, 2019 · 0 comments

Comments

@dprelipcean
Copy link
Contributor

Similar to #125, refactor the reana ExternalBackend to inherit from the yadage ExternalAsyncMixin

The configuration part of the submit method would then be part of the inherited make_external_job method:

        parameters, state = finalize_inputs(parameters, state)
        job = build_job(spec['process'], parameters, state, self.config)

        prettified_cmd, wrapped_cmd = get_commands(job)

        image = spec['environment']['image']
        # tag = spec['environment']['imagetag']

        kerberos = False
        compute_backend = None
        resources = spec['environment'].get('resources', None)
        if resources:
            for item in resources:
                if 'kerberos' in item.keys():
                    kerberos = item['kerberos']
                if 'compute_backend' in item.keys():
                    compute_backend = item['compute_backend']

        log.info('state context is %s', state)
        log.info('would run job %s', job)

        state.ensure()

        log.info('submitting!')

        workflow_uuid = os.getenv('workflow_uuid', 'default')
        job_request_body = {
            'workflow_uuid': workflow_uuid,
            'experiment': os.getenv('REANA_WORKFLOW_ENGINE_YADAGE_EXPERIMENT',
                                    'default'),
            'image': image,
            'cmd': wrapped_cmd,
            'prettified_cmd': prettified_cmd,
            'workflow_workspace': os.getenv('workflow_workspace', 'default'),
            'job_name': metadata['name'],
            'cvmfs_mounts': MOUNT_CVMFS,
        }

        if compute_backend:
            job_request_body['compute_backend'] = compute_backend
        if kerberos:
            job_request_body['kerberos'] = kerberos
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants