<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal">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.<br>
<br>
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.
<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">19 def is_friday():<o:p></o:p></p>
<p class="MsoNormal">20   today = datetime.date.today()<o:p></o:p></p>
<p class="MsoNormal">21   return today.weekday() == calendar.FRIDAY<o:p></o:p></p>
<p class="MsoNormal">22<o:p></o:p></p>
<p class="MsoNormal">23 def is_last_friday():<o:p></o:p></p>
<p class="MsoNormal">24   today = datetime.date.today()<o:p></o:p></p>
<p class="MsoNormal">25   nextweek = today + datetime.timedelta(days=7)<o:p></o:p></p>
<p class="MsoNormal">26   return is_weekend() and nextweek.month != today.month<o:p></o:p></p>
<p class="MsoNormal">….<o:p></o:p></p>
<p class="MsoNormal">133         factory.addStep(steps.ShellCommand(command=util.Interpolate("%s/bg-cli%s VALIDATE drug" % (build_dir, exe))<o:p></o:p></p>
<p class="MsoNormal">134                            ,name="Drug Validation"<o:p></o:p></p>
<p class="MsoNormal">135                            ,doStepIf=lambda step: (isWeekly or isMonthly) and is_ friday ()<o:p></o:p></p>
<p class="MsoNormal">136                            ,hideStepIf=lambda results, s: results==SKIPPED<o:p></o:p></p>
<p class="MsoNormal">137                            ,haltOnFailure=False<o:p></o:p></p>
<p class="MsoNormal">138                            ,flunkOnFailure=False<o:p></o:p></p>
<p class="MsoNormal">139                            ,workdir=util.Interpolate("%(prop:builddir)s/build/runtime")<o:p></o:p></p>
<p class="MsoNormal">140                            ,env={ "LD_LIBRARY_PATH" : util.Interpolate('%(prop:builddir)s/source/external/%(prop:external_dir)s/lib/')<o:p></o:p></p>
<p class="MsoNormal">141                                 ,"DYLD_FALLBACK_LIBRARY_PATH" : util.Interpolate('%(prop:builddir)s/source/external/%(prop:external_dir)s/lib/')<o:p></o:p></p>
<p class="MsoNormal">142                                }<o:p></o:p></p>
<p class="MsoNormal">143                        )<o:p></o:p></p>
<p class="MsoNormal">144         )<o:p></o:p></p>
<p class="MsoNormal"><br>
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.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><b><span lang="PT-BR" style="font-size:10.0pt;font-family:"Arial",sans-serif;color:black">Steven A White, Ph.D
</span></b><span lang="PT-BR" style="font-size:10.0pt;font-family:"Arial",sans-serif;color:black">|<b>Senior Engineer</b></span><span style="font-size:10.5pt;color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:7.5pt;font-family:"Arial",sans-serif;color:#1F497D"><a href="applewebdata://1697E48A-4715-4EFA-AC5E-7847B313B2E4/UrlBlockedError.aspx" target="_blank"><span style="color:#0563C1">Applied Research Associates, Inc.</span></a></span><span style="font-size:10.5pt;color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:7.5pt;font-family:"Arial",sans-serif;color:black">8537 Six Forks Rd., Raleigh, NC 27615</span><span style="font-size:10.5pt;color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:7.5pt;font-family:"Arial",sans-serif;color:black">Phone: 919.582.3300</span><span style="font-size:10.5pt;color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>