def post(self, runfolder="/some/runfolder"): try: url = self.request.uri.strip() expect_param = ["runfolder"] body = self.body_as_object(expect_param) runfolder = body["runfolder"].strip() # Return a new wrapper object depending on what was requested in # the URL, and then ask the process service to start execution. wrapper_type = Wrapper.url_to_type(url) wrapper = Wrapper.new_wrapper(wrapper_type, str(runfolder), self.config_svc) result = self.process_svc.run(wrapper) self.append_status_link(result) resp = {"pid": result.info.pid, "state": result.info.state, "host": result.info.host, "runfolder": result.info.runfolder, "link": result.info.link, "msg": result.info.msg} self.write_accepted(resp) except RuntimeError, err: self.write_object("An error ocurred: " + str(err), http_code=500, reason="An error occurred")
def post(self, runfolder="/some/runfolder"): try: url = self.request.uri.strip() expect_param = ["runfolder"] body = self.body_as_object(expect_param) runfolder = body["runfolder"].strip() # Return a new wrapper object depending on what was requested in # the URL, and then ask the process service to start execution. wrapper_type = Wrapper.url_to_type(url) wrapper = Wrapper.new_wrapper(wrapper_type, str(runfolder), self.config_svc) result = self.process_svc.run(wrapper) self.append_status_link(result) resp = { "pid": result.info.pid, "state": result.info.state, "host": result.info.host, "runfolder": result.info.runfolder, "link": result.info.link, "msg": result.info.msg } self.write_accepted(resp) except RuntimeError, err: self.write_object("An error ocurred: " + str(err), http_code=500, reason="An error occurred")
def get(self, pid): try: url = self.request.uri wrapper_type = Wrapper.url_to_type(url) # Get status for a specific PID and wrapper type if pid: response = self.process_svc.get_status(int(pid), wrapper_type) payload = {"pid": response.pid, "state": response.state, "host": response.host, "msg": response.msg} # If the process was found then we also want to return # the runfolder if response.state is not State.NONE: temp = payload.copy() temp.update({"runfolder": response.runfolder}) payload = temp self.write_status(payload) else: # If a specific PID wasn't requested then return all # processes of the specific wrapper type self.write_status(self.process_svc.get_all(wrapper_type)) except RuntimeError, err: self.write_object("An error occurred: " + str(err))
def get(self, pid): try: url = self.request.uri wrapper_type = Wrapper.url_to_type(url) # Get status for a specific PID and wrapper type if pid: response = self.process_svc.get_status(int(pid), wrapper_type) payload = { "pid": response.pid, "state": response.state, "host": response.host, "msg": response.msg } # If the process was found then we also want to return # the runfolder if response.state is not State.NONE: temp = payload.copy() temp.update({"runfolder": response.runfolder}) payload = temp self.write_status(payload) else: # If a specific PID wasn't requested then return all # processes of the specific wrapper type self.write_status(self.process_svc.get_all(wrapper_type)) except RuntimeError, err: self.write_object("An error occurred: " + str(err))
def post(self, runfolder="/some/runfolder"): """ Start running Sisyphus quick report or quality control for specific runfolder. Args: runfolder: Which runfolder to generate a report or quality control for. (mandatory) qc_config: Supply a custom QC XML config file that will be copied into Sisyphus root folder (mandatory for QC actions) sisyphus_config: Supply a custom YAML config file that will overwrite then default bundled in Sisyphus. (optional) Returns: A status code HTTP 202 if the report generation or quality control is initialised successfully, and a JSON response including a link to the status page to poll. An error code HTTP 500 otherwise. Raises: RuntimeError if an empty POST body was sent in, or an unknown wrapper runner was requested. """ try: url = self.request.uri.strip() wrapper_type = Wrapper.url_to_type(url) wrapper_params = self.setup_wrapper_parameters(wrapper_type) wrapper = Wrapper.new_wrapper(wrapper_type, wrapper_params, self.config_svc) result = self.process_svc.run(wrapper) self.append_status_link(result) resp = { "pid": result.info.pid, "state": result.info.state, "host": result.info.host, "runfolder": result.info.runfolder, "link": result.info.link, "msg": result.info.msg, "service_version": siswrap_version, "sisyphus_version": wrapper.sisyphus_version() } self.write_accepted(resp) except RuntimeError, err: raise tornado.web.HTTPError( 500, "An error occurred: {0}".format(str(err)))
def get(self, pid): """ Get the status for a Sisyphus quick report or quality control run. Args: id: The ID of the process to check status of. Or empty if all processes should be returned. Returns: JSON with fields that describe current status for requested process. List of dicts with Current status of all the processes if input parameter was non-existant. """ try: url = self.request.uri wrapper_type = Wrapper.url_to_type(url) # Get status for a specific PID and wrapper type if pid: response = self.process_svc.get_status(int(pid), wrapper_type) payload = { "pid": response.pid, "state": response.state, "host": response.host, "msg": response.msg, "stdout": response.stdout, "stderr": response.stderr } # If the process was found then we also want to return # the runfolder if response.state is not State.NONE: temp = payload.copy() temp.update({"runfolder": response.runfolder}) payload = temp self.write_status(payload) else: # If a specific PID wasn't requested then return all # processes of the specific wrapper type self.write_status( {"statuses": self.process_svc.get_all(wrapper_type)}) except RuntimeError, err: raise tornado.web.HTTPError( 500, "An error occurred: {0}".format(str(err)))