Beispiel #1
0
    def initialize_processor_cmd( self ):

        # the default task processor is "forrest_run.py"
        # the default directory is the same directory as the master_run
        # the processor can be replaced with a command line argument which may or may not contain a path
        # if it does not contain a path then the default path will be used
        # if a directory is passed on the command line in all cases that will be the location of the processor
        my_run_dir  = None
        my_run_name = None
        my_tmp_name = None
        my_tmp_path = None

        my_run_path = self.option_def( CmdLine.Switches[CmdLine.run_name], None )

        if my_run_path is not None:
            my_run_dir, my_run_name = PathUtils.split_path( my_run_path )
            Msg.user( "Client Dir: %s, Client Name: %s (1)" % (str(my_run_dir), str(my_run_name)), "PROCESS_CMD" )

        if my_run_dir is None:
            my_tmp_path = self.locate_directory( CmdLine.Switches[CmdLine.run_dir], EnVars.run_path, self.module_dir)
            # Msg.user( "Temp Path: [%s] (1)" % (str(my_tmp_path)), "PROCESS_CMD" )

            if PathUtils.check_exe( my_tmp_path ):
                my_run_dir, my_tmp_name = PathUtils.split_path( my_tmp_path )
                # Msg.user( "Client Dir: %s, Client Name: %s (2)" % (str(my_run_dir), str(my_tmp_name)), "PROCESS_CMD" )
            else:
                my_run_dir = my_tmp_path
                # Msg.user( "Client Dir: %s, Client Name: %s (3)" % (str(my_run_dir), str(my_run_name)), "PROCESS_CMD" )

        if my_run_name is None:
            my_run_name = my_tmp_name if my_tmp_name is not None else Defaults.run_name

        # Msg.user( "Client Dir: %s, Client Name: %s (4)" % (str(my_run_dir), str(my_run_name)), "PROCESS_CMD" )
        my_process_cmd = PathUtils.real_path( PathUtils.append_path( PathUtils.include_trailing_path_delimiter( my_run_dir ), my_run_name  ))
        Msg.user( "Process Cmd: %s (1)" % (str(my_process_cmd)), "PROCESS_CMD" )

        my_msg_lev = self.option_def( CmdLine.Switches[CmdLine.client_lev], None)

        if my_msg_lev is not None :
            if my_msg_lev == True:
                my_process_cmd += Msg.get_level_as_str()
                # Msg.user( "Process Cmd: %s (2)" % (str(my_process_cmd)), "PROCESS_CMD" )

            else :
                my_process_cmd += " -l " + my_msg_lev
                Msg.user( "Process Cmd: %s" % (str(my_process_cmd)), "PROCESS_CMD" )

        if self._mAppsInfo.mConfigPath is not None:
            my_process_cmd += " -w %s" % self._mAppsInfo.mConfigPath
        my_process_cmd += " -f %s"

        self.processor_name = my_run_name.replace( ".py", "" ).replace( "_run", "" )
        self.process_cmd = my_process_cmd

        Msg.dbg( "Process Cmd: %s" % (str(self.process_cmd)))