Exemplo n.º 1
0
 def _check_jobs(self, ids):
     """
         Get state of a job in Beaker
     """
     jobs = ["J:" + _id for _id in ids]
     results = {}
     resources = []
     bkrcmd = BeakerCommand('BeakerCommand')
     bkrcmd.check_taskspec_args(jobs)
     for task in jobs:
         myxml = self.hub.taskactions.to_xml(task)
         myxml = myxml.encode('utf8')
         root = eT.fromstring(myxml)
         # TODO: Using getiterator() since its backward compatible
         # with Python 2.6
         # This is deprectated in 2.7 and we should be using iter()
         for job in root.getiterator('job'):
             results.update({
                 'job_id': job.get('id'),
                 'results': job.get('result')
             })
         for recipe in root.getiterator('recipe'):
             resources.append({
                 'family': recipe.get('family'),
                 'distro': recipe.get('distro'),
                 'arch': recipe.get('arch'),
                 'variant': recipe.get('variant'),
                 'system': recipe.get('system'),
                 'status': recipe.get('status'),
                 'result': recipe.get('result'),
                 'id': recipe.get('job_id')
             })
             results.update({'resources': resources})
     return results
Exemplo n.º 2
0
 def check_jobs(self, jobs):
     # slightly modified copy of the same method in bkr_info, used here to
     # let bkr_server return beaker job info in the same structure as
     # bkr_info so we can stash provisioning details in rundb before the
     # bkr_info task blocks on waiting for the beaker job(s) to finish.
     # Importing code from bkr_info is not an option due to ansible's
     # sandboxing; bkr_info is not guaranteed to be importable at runtime.
     resources = []
     bkrcmd = BeakerCommand('BeakerCommand')
     bkrcmd.check_taskspec_args(jobs)
     for task in jobs:
         myxml = self.hub.taskactions.to_xml(task)
         myxml = myxml.encode('utf8')
         root = eT.fromstring(myxml)
         # Using getiterator() since its backward compatible with py26
         for recipe in root.getiterator('recipe'):
             resources.append({
                 'family': recipe.get('family'),
                 'distro': recipe.get('distro'),
                 'arch': recipe.get('arch'),
                 'variant': recipe.get('variant'),
                 'system': recipe.get('system'),
                 'status': recipe.get('status'),
                 'result': recipe.get('result'),
                 'rid': recipe.get('id'),
                 'id': recipe.get('job_id')
             })
     return resources
Exemplo n.º 3
0
 def check_jobs(self, jobs):
     # slightly modified copy of the same method in bkr_info, used here to
     # let bkr_server return beaker job info in the same structure as
     # bkr_info so we can stash provisioning details in rundb before the
     # bkr_info task blocks on waiting for the beaker job(s) to finish.
     # Importing code from bkr_info is not an option due to ansible's
     # sandboxing; bkr_info is not guaranteed to be importable at runtime.
     resources = []
     bkrcmd = BeakerCommand('BeakerCommand')
     bkrcmd.check_taskspec_args(jobs)
     for task in jobs:
         myxml = self.hub.taskactions.to_xml(task)
         myxml = myxml.encode('utf8')
         root = eT.fromstring(myxml)
         # Using getiterator() since its backward compatible with py26
         for recipe in root.getiterator('recipe'):
             resources.append({'family': recipe.get('family'),
                               'distro': recipe.get('distro'),
                               'arch': recipe.get('arch'),
                               'variant': recipe.get('variant'),
                               'system': recipe.get('system'),
                               'status': recipe.get('status'),
                               'result': recipe.get('result'),
                               'rid': recipe.get('id'),
                               'id': recipe.get('job_id')})
     return resources
Exemplo n.º 4
0
 def _check_jobs(self):
     """
         Get state of a job in Beaker
     """
     jobs = _jprefix(self.ids)
     resources = []
     bkrcmd = BeakerCommand('BeakerCommand')
     bkrcmd.check_taskspec_args(jobs)
     for task in jobs:
         myxml = self.hub.taskactions.to_xml(task)
         myxml = myxml.encode('utf8')
         root = eT.fromstring(myxml)
         # Using getiterator() since its backward compatible with py26
         for recipe in root.getiterator('recipe'):
             resources.append({
                 'family': recipe.get('family'),
                 'distro': recipe.get('distro'),
                 'arch': recipe.get('arch'),
                 'variant': recipe.get('variant'),
                 'system': recipe.get('system'),
                 'status': recipe.get('status'),
                 'result': recipe.get('result'),
                 'id': recipe.get('job_id')
             })
     return resources, len(resources)
Exemplo n.º 5
0
 def check_jobs(self, jobs):
     """
         Get state of a job in Beaker
     """
     results = {}
     resources = []
     bkrcmd = BeakerCommand('BeakerCommand')
     bkrcmd.check_taskspec_args(jobs)
     for task in jobs:
         myxml = self.hub.taskactions.to_xml(task)
         myxml = myxml.encode('utf8')
         LOG.debug(xml.dom.minidom.parseString(myxml)
                      .toprettyxml(encoding='utf8'))
         root = eT.fromstring(myxml)
         # TODO: Using getiterator() since its backward compatible
         # with Python 2.6
         # This is deprectated in 2.7 and we should be using iter()
         for job in root.getiterator('job'):
             results.update({'job_id': job.get('id'),
                             'results': job.get('result')})
         for recipe in root.getiterator('recipe'):
             resources.append({'family': recipe.get('family'),
                               'distro': recipe.get('distro'),
                               'arch': recipe.get('arch'),
                               'variant': recipe.get('variant'),
                               'system': recipe.get('system'),
                               'status': recipe.get('status'),
                               'result': recipe.get('result')})
             results.update({'resources': resources})
     return results
Exemplo n.º 6
0
 def _check_jobs(self):
     """
         Get state of a job in Beaker
     """
     jobs = _jprefix(self.ids)
     resources = []
     bkrcmd = BeakerCommand('BeakerCommand')
     bkrcmd.check_taskspec_args(jobs)
     for task in jobs:
         myxml = self.hub.taskactions.to_xml(task)
         myxml = myxml.encode('utf8')
         root = eT.fromstring(myxml)
         # Using getiterator() since its backward compatible with py26
         for recipe in root.getiterator('recipe'):
             resources.append({'family': recipe.get('family'),
                               'distro': recipe.get('distro'),
                               'arch': recipe.get('arch'),
                               'variant': recipe.get('variant'),
                               'system': recipe.get('system'),
                               'status': recipe.get('status'),
                               'result': recipe.get('result'),
                               'rid': recipe.get('id'),
                               'id': recipe.get('job_id')})
     return resources, len(resources)