def take_action(self, parsed_args): url = parsed_args.url username = parsed_args.username password = parsed_args.password project = parsed_args.project flow = parsed_args.flow schedule = Schedule(url, username, password) sc = schedule.get_schedule(project, flow) if sc is None: raise Exception("no such shedule") print "firstSchedTime:%s, submitUser:%s, period:%s, scheduleId:%s, nextExecTime:%s" % (sc["firstSchedTime"], sc["submitUser"], sc["period"], sc["scheduleId"], sc["nextExecTime"])
def take_action(self, parsed_args): url = parsed_args.url username = parsed_args.username password = parsed_args.password schedule = Schedule(url, username, password) items = schedule.list_schedules() most_recent_next_exec_time = None for item in items: flow = item["flowname"] project = item["projectname"] sc = schedule.get_schedule(project, flow) dt = datetime.strptime(sc["nextExecTime"], '%Y-%m-%d %H:%M:%S') if most_recent_next_exec_time is None: most_recent_next_exec_time = dt if most_recent_next_exec_time > dt: most_recent_next_exec_time = dt if most_recent_next_exec_time is None: raise Exception("schedule is not found") print most_recent_next_exec_time.strftime("%Y-%m-%d %H:%M:%S")