0

Scheduling during work hours

We're trying to set up a schedule that refreshes a model during business hours only, between say 8 am and 8pm, M-F.

Most importantly, we need to make sure it doesn't interfere with our nightly db backup.

Because the start/end is both date and time, we're struggling to figure out how to achieve this.

Thanks!

6 replies

null
    • Customer Solutions Architect
    • Moshe_Yossef
    • 10 mths ago
    • Reported - view

    Hi 

    One solution could be:

    1. create a one time schedule for the desired model (Model A).

    2. Create a new model file, go to master flow, delete the default data falow.

    3. use conditional elements to determine whether we want to refresh the model right now (PQL along the lines of Hour(date()) >= 8 && Hour(Date() <=20 ).

    4. The True node of the  conditional should go to a pyramid event, that will run the one time schedule of Model A.

    5. There will not be a false node.

     

    Does this make sense?

      • Bruce_Campbell
      • 10 mths ago
      • Reported - view

       Thanks for the reply Moshe.  This makes sense, however the PQL is not compiling.

      This returns "error: cannot find symbol:

       

      Hour(date()) >= 8 && Hour(Date()) <=20

      These did not work either:

      ConvertToNumber(DateFormat(DateTime()), "HH") >= 8 && ConvertToNumber(DateFormat(DateTime()), "HH") <= 20
      
      ConvertToNumber(Hour(DateTime())) >= 8 && ConvertToNumber(Hour(DateTime())) <= 20
      
      ConvertToNumber(Hour(StringToDateTime(DateTime()))) >= 8 && ConvertToNumber(Hour(StringToDateTime(DateTime()))) <= 20
      
      ConvertToNumber(DateFormat(StringToDateTime(DateTime())), "HH") >= 8 && ConvertToNumber(DateFormat(StringToDateTime(DateTime())), "HH") <= 20
      • Customer Solutions Architect
      • Moshe_Yossef
      • 10 mths ago
      • Reported - view

       
      Well you were very close :-) here's my code debugged:

      hour(datetime()) >= 8 && hour(datetime()) <20
      

      or (this is yours with proper brackets :-) )

      ConvertToNumber(DateFormat(DateTime(), "HH")) >= 8 && ConvertToNumber(DateFormat(DateTime(), "HH")) <= 20
      

      They are both working for me in an example.conditional for Model.pie

      • Bruce_Campbell
      • 10 mths ago
      • Reported - view

       - Thanks Moshe!  Brackets... that's embarrassing!  😄

    • Customer Solutions Architect
    • Moshe_Yossef
    • 10 mths ago
    • Reported - view

    Also - you can create a schedule and call it using the API - and then schedule the API call using whatever scheduler you have.

      • Bruce_Campbell
      • 10 mths ago
      • Reported - view

       With respect to calling the API from a scheduler:

      There doesn't seem to be a Pyramid API to create a task/schedule;  Is that true?  Such an API would be ideal for us, given our many clients and environments, and also because we purge our models and them import them from a PIE file as part of our automated deployment process;  The PIE does not contain the schedule, and the purge will effectively remove the associated schedule.  Any thoughts on a solution for this?

      Thanks again!

      Bruce

Content aside

  • Status Answered
  • 10 mths agoLast active
  • 6Replies
  • 54Views
  • 6 Following