Exemplo n.º 1
0
    def executePipelines(self):

        result = True

        while len(self.serverQueue) > 0:

            params = self.serverQueue[0]
            pipelines_filepath = params[0]
            pipeline_options = params[1]
            try:
                verbosity = int(params[2])
            except ValueError:
                verbosity = 1
            resume = (params[3].lower() == "true")
            working_dir = params[4]

            # Modifies the config if required and initialize logs and output directory
            if working_dir != None and len(working_dir) > 0:
                self.config[PFConstants.BASE_OUTPUT_DIR_PARAM] = working_dir

            # Verify the base output dir and the output dir are created and create them if not
            FileUtils.createDirectory(
                self.config[PFConstants.BASE_OUTPUT_DIR_PARAM], 0777)
            self.config[PFConstants.OUTPUT_DIR_PARAM] = os.path.join(
                self.getParameter(PFConstants.BASE_OUTPUT_DIR_PARAM),
                PFConstants.OUTPUT_DIR_NAME)
            FileUtils.createDirectory(
                self.config[PFConstants.OUTPUT_DIR_PARAM], 0777)

            # Switch log location
            Log.switchFiles(self.getParameter(PFConstants.OUTPUT_DIR_PARAM),
                            verbosity)

            # Parse the XML file to retrieve the pipelines definition
            Log.trace(
                "#################################################################################"
            )
            Log.trace(
                "# PipelineManager.executePipelines : Reading pipelines from : "
                + pipelines_filepath)
            Log.trace(
                "#################################################################################"
            )

            try:
                pipelines = PipelineXMLParser.getPipelines(pipelines_filepath)
                OptionManager.applyOptions(pipelines, pipeline_options)
                PipelineXMLParser.toXMLFile(
                    self.config[PFConstants.OUTPUT_DIR_PARAM], pipelines)
            except SyntaxError, syn_exce:
                raise ParsingException(
                    "PipelineManager.executePipelines : Unable to read definition of pipelines from XML file: '"
                    + pipelines_filepath + "'. From:\n\t---> " + str(syn_exce))
            except ParsingException, par_exce:
                raise ParsingException(
                    "PipelineManager.executePipelines : Unable to read definition of pipelines from XML file: '"
                    + pipelines_filepath + "'. From:\n\t---> " + str(par_exce))
Exemplo n.º 2
0
                    "--------------------------------------------------------------------------"
                )
                pipeline_output = os.path.join(
                    self.getParameter(PFConstants.OUTPUT_DIR_PARAM),
                    pipeline.name)

                liste_dir = FileUtils.getDirectoryList(
                    os.path.dirname(pipeline_output))
                liste_file = FileUtils.getFileList(
                    os.path.dirname(pipeline_output), None)

                # Manage the pipeline output directory and the logs
                if resume == False:
                    shutil.rmtree(pipeline_output, True)
                    FileUtils.createDirectory(pipeline_output, 0777)
                    Log.switchFiles(pipeline_output)
                else:
                    print "creating dir : " + pipeline_output
                    FileUtils.createDirectory(pipeline_output, 0777)
                    Log.initLog(pipeline_output)
                ProgressionManager.setPipelineStatus(
                    pipeline, ProgressionManager.RUNNING_STATUS)
                shutil.copy(
                    os.path.join(
                        self.config[PFConstants.INSTALL_DIR_PARAM],
                        os.path.join(PFConstants.PROGRESSION_XSL_PATH,
                                     PFConstants.PROGRESSION_XSL_FILE)),
                    pipeline_output)

                # Fill the queue with the pipeline first components
                component_queue_list = pipeline.firstComponents