[users at bb.net] is the buildset's submitted_at available to a buildstep when determining doStepIf

Povilas Kanapickas povilas at radix.lt
Mon May 3 18:25:19 UTC 2021


Hi Steven,

On 5/3/21 9:12 PM, Steven White wrote:
> So, I’m trying to use the day of the week my nightly scheduler was
>  submitted to determine if some steps should be skipped. The idea is to
> run additional steps that take a long time on Friday night and once a
> month run additional longer steps which will take the entire weekend to
> complete.
> 
> So I was running the following code, but realized it fails if the steps
> executed before the “Drug Validation” step have caused the current time
> to roll over to the Saturday.  So an easy work around is to check for
> the weekend, but I was hopping to just use the submission time of the
> buildstep.  I get a little confused on what is available to me in the
> python objects so I thought I would ask.

You can set a build property to the time at the start of the build using
a SetProperty build step and a renderable function. Then you can use
custom renderables to read this property and check against whatever
Python code you want.

See
http://docs.buildbot.net/3.1.1/manual/configuration/properties.html#renderer

Cheers,
Povilas

>  
> 
> 19 def is_friday():
> 
> 20   today = datetime.date.today()
> 
> 21   return today.weekday() == calendar.FRIDAY
> 
> 22
> 
> 23 def is_last_friday():
> 
> 24   today = datetime.date.today()
> 
> 25   nextweek = today + datetime.timedelta(days=7)
> 
> 26   return is_weekend() and nextweek.month != today.month
> 
> ….
> 
> 133        
> factory.addStep(steps.ShellCommand(command=util.Interpolate("%s/bg-cli%s
> VALIDATE drug" % (build_dir, exe))
> 
> 134                            ,name="Drug Validation"
> 
> 135                            ,doStepIf=lambda step: (isWeekly or
> isMonthly) and is_ friday ()
> 
> 136                            ,hideStepIf=lambda results, s:
> results==SKIPPED
> 
> 137                            ,haltOnFailure=False
> 
> 138                            ,flunkOnFailure=False
> 
> 139                           
> ,workdir=util.Interpolate("%(prop:builddir)s/build/runtime")
> 
> 140                            ,env={ "LD_LIBRARY_PATH" :
> util.Interpolate('%(prop:builddir)s/source/external/%(prop:external_dir)s/lib/')
> 
> 141                                 ,"DYLD_FALLBACK_LIBRARY_PATH" :
> util.Interpolate('%(prop:builddir)s/source/external/%(prop:external_dir)s/lib/')
> 
> 142                                }
> 
> 143                        )
> 
> 144         )
> 
> 
> I’m assuming I can write a function that uses the Data API for this, but
> I just don’t understand enough python to wrap my head around the yield
> self.master.data syntax I keep seeing through out the code and I’m
> hoping someone on the list can provide a little feedback on how to
> access data elements like this when passing in these conditional lambdas.
> 
>  
> 
>  
> 
> *Steven A White, Ph.D *|*Senior Engineer*
> 
> Applied Research Associates, Inc.
> <applewebdata://1697E48A-4715-4EFA-AC5E-7847B313B2E4/UrlBlockedError.aspx>
> 
> 8537 Six Forks Rd., Raleigh, NC 27615
> 
> Phone: 919.582.3300
> 
>  
> 
> 
> _______________________________________________
> users mailing list
> users at buildbot.net
> https://lists.buildbot.net/mailman/listinfo/users
> 


More information about the users mailing list