Forum Discussion

PeteJames's avatar
PeteJames
Qrew Cadet
10 months ago

Jinja time check in Pipelines

I wish to stop my pipelines running outside of working hours

I have an IF section with advanced expression. What is the correct syntax to check whether the current hour is greater than or equal to a given hour?

I have tried

{{time.now.hour <= 15'}}

{{time.now.hour <= '5}}

but these don't seem to work

thank you



------------------------------
Pete James
------------------------------
  • I was able to get it to work no issue - from your screenshot you seem to have a ' after the 15 and before the 5. Time.now.hour should return an integer so you should be comparing it to just an integer, remove the '

    {{time.now.hour <= 15}}

    Also make sure that you're accounting for UTC time in your values - so if you're using for EST working hours you'll need to add 6 to the hours you're targeting (ie 5PM EST would be 23)



    ------------------------------
    Chayce Duncan
    ------------------------------
  • thanks.. working now



    ------------------------------
    Pete James
    ------------------------------