예제 #1
0
 def take_action(self, parsed_args):
     url = parsed_args.url
     username = parsed_args.username
     password = parsed_args.password
     session = Session(url, username, password)
     session_id = session.get_session_id()
     project = parsed_args.project
     flow = parsed_args.flow
     p = Project()
     project_id = p.get_project_id(url, session_id, project)
     params = {"ajax": "scheduleFlow"}
     params["session.id"] = session_id
     params["projectName"] = project
     params["projectId"] = project_id
     params["flow"] = flow
     params["scheduleDate"] = parsed_args.date
     params["scheduleTime"] = parsed_args.time
     if parsed_args.period:
         params["is_recurring"] = 'on'
         params["period"] = parsed_args.period
     if parsed_args.option:
         params.update(literal_eval(parsed_args.option))
     r = requests.post(url + "/schedule", data=params)
     jc = r.json()
     if jc.get("status") == 'success':
         print("add schedule succeeded. message=%s" % (jc.get("message")))
     elif jc.get("status") == 'error':
         raise Exception("add schedule failed. message=%s. error=%s" %
                         (jc.get("message"), jc.get("error")))
     else:
         raise Exception("add schedule failed. error=%s" %
                         (jc.get("error")))
예제 #2
0
 def take_action(self, parsed_args):
     url = parsed_args.url
     username = parsed_args.username
     password = parsed_args.password
     session = Session(url, username, password)
     session_id = session.get_session_id()
     project = parsed_args.project
     flow = parsed_args.flow
     p = Project()
     project_id = p.get_project_id(url, session_id, project)
     params = {"ajax":"scheduleFlow"}
     params["session.id"] = session_id
     params["projectName"] = project
     params["projectId"] = project_id
     params["flow"] = flow
     params["scheduleDate"] = parsed_args.date
     params["scheduleTime"] = parsed_args.time
     if parsed_args.period:
         params["is_recurring"] = 'on'
         params["period"] = parsed_args.period
     if parsed_args.option:
         params.update(literal_eval(parsed_args.option))
     r = requests.post(url + "/schedule", data=params)
     jc = r.json()
     if jc.get("status") == 'success':
         print("add schedule succeeded. message=%s" % (jc.get("message")))
     if jc.get("status") == 'error':
         raise Exception("add schedule failed. message=%s. error=%s" % (jc.get("message"), jc.get("error")))
예제 #3
0
 def get_schedule(self, project, flow):
     session = Session(self.url, self.username, self.password)
     session_id = session.get_session_id()
     params = {"ajax":"fetchSchedule"}
     params["session.id"] = session_id
     p = Project()
     project_id = p.get_project_id(self.url, session_id, project)
     params["projectId"] = project_id
     params["flowId"] = flow
     r = requests.get(self.url + "/schedule", params=params)
     jc = r.json()
     return jc.get("schedule")