Esempio n. 1
0
 def testPidfileNotThere(self):
   # _pid_is_alive should not be called here and it is an error if it is.
   # pylint: disable=redundant-unittest-assert
   self.mock(
       master, '_pid_is_alive',
       lambda _x: self.assertTrue(False))  # pragma: no cover
   # There is no twistd.pid in chromium.webkit.
   self.assertFalse(master.buildbot_is_running(self.chromium_webkit))
Esempio n. 2
0
 def testPidfileNotThere(self):
   # _pid_is_alive should not be called here and it is an error if it is.
   # pylint: disable=redundant-unittest-assert
   self.mock(
       master, '_pid_is_alive',
       lambda _x: self.assertTrue(False))  # pragma: no cover
   # There is no twistd.pid in chromium.webkit.
   self.assertFalse(master.buildbot_is_running(self.chromium_webkit))
Esempio n. 3
0
def collect_evidence(master_directory, connection_timeout=30):
  """Collects evidence from the OS for late state determination."""
  evidence = {}
  evidence['now'] = timestamp.utcnow_ts()
  evidence['last_boot'] = master.get_last_boot(master_directory)
  evidence['last_no_new_builds'] = master.get_last_no_new_builds(
      master_directory)
  evidence['buildbot_is_running'] = master.buildbot_is_running(master_directory)

  if evidence['buildbot_is_running']:
    accepting_builds, current_running_builds = master.get_buildstate(
        master_directory, timeout=connection_timeout)
    evidence['accepting_builds'] = accepting_builds
    evidence['current_running_builds'] = current_running_builds

  return evidence
Esempio n. 4
0
def collect_evidence(master_directory, connection_timeout=30,
                     builder_filters=None):
  """Collects evidence from the OS for late state determination."""
  evidence = {}
  evidence['now'] = timestamp.utcnow_ts()
  evidence['last_boot'] = master.get_last_boot(master_directory)
  evidence['last_no_new_builds'] = master.get_last_no_new_builds(
      master_directory)
  evidence['buildbot_is_running'] = master.buildbot_is_running(master_directory)

  if evidence['buildbot_is_running']:
    accepting_builds, current_running_builds = master.get_buildstate(
        master_directory, timeout=connection_timeout)
    evidence['accepting_builds'] = accepting_builds

    if builder_filters:
      current_running_builds = set(b for b in current_running_builds
                                   if any(f.match(b[0])
                                      for f in builder_filters))
    evidence['current_running_builds'] = current_running_builds
  return evidence
Esempio n. 5
0
def collect_evidence(master_directory, connection_timeout=30,
                     builder_filters=None):
  """Collects evidence from the OS for late state determination."""
  evidence = {}
  evidence['now'] = timestamp.utcnow_ts()
  evidence['last_boot'] = master.get_last_boot(master_directory)
  evidence['last_no_new_builds'] = master.get_last_no_new_builds(
      master_directory)
  evidence['buildbot_is_running'] = master.buildbot_is_running(master_directory)

  if evidence['buildbot_is_running']:
    accepting_builds, current_running_builds = master.get_varz(
        master_directory, timeout=connection_timeout)
    evidence['accepting_builds'] = accepting_builds

    if builder_filters:
      current_running_builds = {
          b: c for b, c in current_running_builds.iteritems()
          if any(f.match(b) for f in builder_filters)}

    # Add up the total number of running builds.
    current_running_builds = sum(current_running_builds.itervalues())
    evidence['current_running_builds'] = current_running_builds
  return evidence
Esempio n. 6
0
 def testPidIsNotRunning(self):
   self.mock(master, '_pid_is_alive', lambda _x: False)
   self.assertFalse(master.buildbot_is_running(self.chromium_fyi))
Esempio n. 7
0
 def testPidIsNotRunning(self):
   self.mock(master, '_pid_is_alive', lambda _x: False)
   self.assertFalse(master.buildbot_is_running(self.chromium_fyi))