[Buildbot-devel] Blocker step not working as expected - what is wrong?

André Anjos andre.anjos at idiap.ch
Wed Mar 21 19:39:21 UTC 2012


Hello,

I just implemented a blocker step (sub-classed as required) to one of
our builds. This build has to wait for some other step in another
builder.

Here is the code for the Blocker derived class that worked for me:

class WaitDatabase(Blocker):
  """Implements a waiting step that waits for the database to be installed"""

  name = "db_sync"

  def buildsMatch(self, buildStatus1, buildStatus2):

    n2 = buildStatus2.getBuilder().getName()
    depbuilder = self.upstreamSteps[0][0]
    depstep = self.upstreamSteps[0][1]

    if buildStatus2.getBuilder().getName() == depbuilder and \
        (not buildStatus2.isFinished()):
      for step in buildStatus2.getSteps():
        if step.getName() == depstep:
          if not step.isFinished():
            # we must wait
            self._log("Waiting for unfinished %s step on %s", depstep,
depbuilder)
            return True

    return False

A few comments:

1. If I don't actually check if the step is not there, I get the wrong
build, strangely, with the right name. (background information: I
recently changed the builds, so I don't know if that is the reason.
The names for steps that I get seem to be the old one.) It seems that
the master is offering the latest builds for every builder for this
method to test. I would imagine that builds that are finished don't
need testing anymore...

2. After this method returns, everything seems to work as "planned"

2012-03-21 17:10:31+0100 [-] <WaitDatabase 33af3f8: db_sync>:
searching for upstream build steps
2012-03-21 17:10:31+0100 [-] <WaitDatabase 33af3f8: db_sync>: no
matching builds found in builder 'idiap-10.04-x86_64-release':
skipping it
2012-03-21 17:10:31+0100 [-] <WaitDatabase 33af3f8: db_sync>: will
block on 0 upstream build steps: []
2012-03-21 17:10:31+0100 [-] <WaitDatabase 33af3f8: db_sync>: after
registering for each upstream build step, _blocking_steps = []

Except that, at this point, the build in question blocks indefinetely,
waiting for zero steps to unblock it.

How to fix this?

Thanks for any tip. A

-- 
Dr. André Anjos
Idiap Research Institute
Centre du Parc - rue Marconi 19
CH-1920 Martigny, Suisse
Phone: +41 27 721 7763
Fax: +41 27 721 7712
http://andreanjos.org




More information about the devel mailing list