コード例 #1
0
    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")
コード例 #2
0
ファイル: handlers.py プロジェクト: withrocks/arteria-siswrap
    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")
コード例 #3
0
    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)))