Exemplo n.º 1
0
    def run(self):
        proj = settings.PROJECT_SHORTNAME
        pollers = getattr(settings, 'ESSARCH_WORKFLOW_POLLERS', {})
        for name, poller in pollers.items():
            backend = get_backend(name)
            poll_path = poller['path']
            poll_sa = poller.get('sa')
            context = {
                'WORKFLOW_POLLER': name,
                'WORKFLOW_POLL_PATH': poll_path
            }
            for ip in backend.poll(poll_path, poll_sa):
                profile = ip.submission_agreement.profile_workflow
                try:
                    spec = profile.specification[proj]
                except KeyError:
                    self.logger.debug(u'No workflow specified in {} for current project {}'.format(profile, proj))
                    continue
                except AttributeError:
                    if profile is None:
                        self.logger.debug(u'No workflow profile in SA')
                        continue
                    raise

                workflow = create_workflow(spec['tasks'], ip=ip, name=spec.get('name', ''),
                                           on_error=spec.get('on_error'), context=context)
                workflow.run()
Exemplo n.º 2
0
    def get_workflows():
        pollers = getattr(settings, 'ESSARCH_WORKFLOW_POLLERS', {})
        for name, poller in pollers.items():
            backend = get_backend(name)
            poll_path = poller['path']
            poll_sa = poller.get('sa')
            context = {
                'WORKFLOW_POLLER': name,
                'WORKFLOW_POLL_PATH': poll_path
            }
            for ip in backend.poll(poll_path, poll_sa):
                profile = ip.submission_agreement.profile_workflow
                try:
                    spec = profile.specification
                except AttributeError:
                    if profile is None:
                        self.logger.debug('No workflow profile in SA')
                        continue
                    raise

                yield create_workflow(spec['tasks'],
                                      ip=ip,
                                      name=spec.get('name', ''),
                                      on_error=spec.get('on_error'),
                                      context=context)
Exemplo n.º 3
0
    def run(self, backend_name, poll_path):
        backend_name, poll_path = self.parse_params(backend_name, poll_path)
        backend = get_backend(backend_name)

        ip = self.get_information_package()
        backend.delete_source(poll_path, ip)