def submit_job()

in pygenie/adapter/genie_3.py [0:0]


    def submit_job(self, job, timeout=30, **kwargs):
        """Submit a job execution to the server."""

        payload = {
            key: value for key, value in get_payload(job).items() \
            if value is not None \
                and value != [] \
                and value != {} \
                and value != ''
        }

        attachments = payload.get('attachments', [])
        if 'attachments' in payload:
            del payload['attachments']

        files = [('request', ('', json.dumps(payload), 'application/json'))]

        for att in attachments:
            files.append(('attachment', att))
            logger.debug('adding attachment: %s', att)

        logger.debug('payload to genie 3:')
        logger.debug(json.dumps(payload,
                                sort_keys=True,
                                indent=4,
                                separators=(',', ': ')))

        self.call(method='post',
                  url='{}/{}'.format(job._conf.genie.url, Genie3Adapter.JOBS_ENDPOINT),
                  files=files,
                  timeout=None if self.disable_timeout else timeout,
                  auth_handler=self.auth_handler,
                  failure_codes=409,
                  **kwargs)