Sign up to take part
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
I am trying to trigger a scenario based on python script but it is not working. It doesn't trigger at all.
Can someone tell me what I am doing wrong?
The script is :
from dataiku.scenario import Trigger
from datetime import date
import pytz
tz = pytz.timezone('Europe/Amsterdam')
t = Trigger()
now = datetime.datetime.now(tz = tz)
dayofweek =now.isoweekday()
hour = now.hour
if dayofweek in [1,2,3,4,5] and (hour >= 7 and hour <=23):
t.fire()
Hi @pkansal ,
I think your import datetime is not working
Can you try :
from dataiku.scenario import Trigger
from datetime import datetime
import pytz
tz = pytz.timezone('Europe/Amsterdam')
t = Trigger()
now = datetime.now(tz = tz)
dayofweek =now.isoweekday()
hour = now.hour
if dayofweek in [1,2,3,4,5] and (hour >= 7 and hour <=23):
t.fire()
Hi @pkansal ,
I think your import datetime is not working
Can you try :
from dataiku.scenario import Trigger
from datetime import datetime
import pytz
tz = pytz.timezone('Europe/Amsterdam')
t = Trigger()
now = datetime.now(tz = tz)
dayofweek =now.isoweekday()
hour = now.hour
if dayofweek in [1,2,3,4,5] and (hour >= 7 and hour <=23):
t.fire()
Thanks! It works now.