示例#1
0
    def load_task_info(self):

        self.task_id = None
        self.task_index = None
        self.work_dir = None
        self.work_dir, my_tmp = PathUtils.split_path(self.frun_path)
        my_tmp, my_index = PathUtils.split_dir(self.work_dir)
        my_tmp, self.task_id = PathUtils.split_dir(my_tmp)
        self.task_index = int(my_index)
    def __init__(
            self, arg_frun_path, arg_ctrl_item,
            arg_content):  #  parent_fctrl, arg_fctrl_item, arg_item_group ):
        # def __init__( self, arg_frun_path, arg_parent_fctrl, arg_fctrl_item, arg_item_group, arg_content ):
        super().__init__()
        self.frun_path = arg_frun_path
        self.work_dir, my_tmp = PathUtils.split_path(arg_frun_path)
        self.ctrl_item = arg_ctrl_item

        self.parent_fctrl = arg_ctrl_item.parent_fctrl
        self.fctrl_item = arg_ctrl_item.fctrl_item
        self.item_group = arg_ctrl_item.group
        # self.frun_str     = arg_frun_str
        self.content = arg_content
示例#3
0
    def process(self):

        # Msg.dbg( "ExecuteController::process()")

        # my_usr_lbl = Msg.set_label( "user", "EXEC-VALS" )
        # Msg.lout( self.ctrl_item.catalougs(), "user", "Control Item Cataloug" )
        my_task_file = PathUtils.include_trailing_path_delimiter(
            self.ctrl_item.parent_data.test_root)
        my_task_file += PathUtils.include_trailing_path_delimiter(
            self.ctrl_item.fctrl_dir)
        my_task_file += self.ctrl_item.fctrl_name

        my_tmp, my_task_ndx = PathUtils.split_path(self.ctrl_item.fctrl_dir)
        my_task_name = self.ctrl_item.fctrl_name.replace(".py", "")

        # Msg.user( "Task File: %s, Task Name: %s, Task Index: %s" % ( my_task_file, my_task_name, my_task_ndx )  )

        self.process_task_file(my_task_file, my_task_name, my_task_ndx)
示例#4
0
    def resolve_file_location(self):

        my_fctrl_dir, self.fctrl_name = PathUtils.split_path(
            str(self.fctrl_name))

        Msg.user(
            "Extracted File Path: %s, Control File Path: %s, Extracted File Name: %s"
            % (str(my_fctrl_dir), str(self.fctrl_dir), str(self.fctrl_name)),
            "FCTRL-DIR")
        Msg.user(
            "1 - Control Directory: %s, Force Directory: %s, Test Root: %s, Work Dir: %s, Control File: %s, self.fctrl_dir: %s"
            % (my_fctrl_dir, self.parent_data.force_path,
               self.parent_data.test_root, self.parent_data.work_dir,
               self.fctrl_name, self.fctrl_dir), "FCTRL-DIR")
        # if the name does not contain a path use the contol directory
        if my_fctrl_dir is None:
            my_fctrl_dir = self.fctrl_dir

        Msg.user(
            "Control Directory: %s, Force Directory: %s, Test Root: %s, Work Dir: %s, Control File: %s"
            % (my_fctrl_dir, self.parent_data.force_path,
               self.parent_data.test_root, self.parent_data.work_dir,
               self.fctrl_name), "FCTRL-DIR")

        # because of the requirement of not knowing and needing to discover the directory
        # situation it is necessary to search for the control file
        my_tmp = None
        my_tmp_dir = None

        # if the a directory was specified in the control name or a specifies as part of the control item it is
        # necessary to check for either a absolute path or relative parent path
        # Msg.dbg( "Checking: [%s] for [%s]" % ( my_fctrl_dir, self.fctrl_name ))

        if my_fctrl_dir is None:
            raise Exception(
                "Control File Location was not specified, File[%s]" %
                (self.fctrl_name))

        if self.check_full_path(my_fctrl_dir):
            Msg.user("Using Real Path as Control Directory", "FILE_LOCATION")
            pass

        elif self.check_parent_dir(my_fctrl_dir):
            Msg.user("Using Parent Directory as Control Directory",
                     "FILE_LOCATION")
            pass

        elif self.check_work_dir(my_fctrl_dir):
            Msg.user(
                "Using Current Control File Location as Control Directory",
                "FILE_LOCATION")
            pass

        elif self.check_ctrl_dir(my_fctrl_dir):
            Msg.user("Using Specified Control Directory as Control Directory",
                     "FILE_LOCATION")
            pass

        else:

            if self.item_type() == ControlItemType.TaskItem:
                my_err_queue_item = SummaryErrorQueueItem({
                    "error":
                    "Template Not Found at Specified Location",
                    "message":
                    "Template File Not Found ...",
                    "path":
                    self.file_path(),
                    "type":
                    str("FileNotFoundError")
                })
                self.summary().queue.enqueue(my_err_queue_item)

            elif self.item_type() == ControlItemType.FileItem:
                my_err_queue_item = SummaryErrorQueueItem({
                    "error":
                    "FileNotFoundError",
                    "message":
                    "Control File Not Found at Specified Location",
                    "path":
                    self.file_path(),
                    "type":
                    str("FileNotFoundError")
                })
                self.summary().queue.enqueue(my_err_queue_item)

            raise Exception("File[%s] Not Found at Location Specified[%s]" %
                            (self.fctrl_name, my_fctrl_dir))

        # Msg.dbg( "Raw Control Directory: %s" % ( self.fctrl_dir ))
        # Msg.dbg( "Test Root: %s" % ( self.test_root ))
        # remove the test root if present
        if SysUtils.found(self.fctrl_dir.find(self.parent_data.test_root)):
            # Msg.dbg( "Test Root Found" )
            self.fctrl_dir = self.fctrl_dir.replace(self.parent_data.test_root,
                                                    "")

        # Msg.dbg( "Trimmed Control Directory: %s" % ( self.fctrl_dir ))

        # add the trailing path delimiter
        self.fctrl_dir = PathUtils.include_trailing_path_delimiter(
            self.fctrl_dir)
        Msg.user("Delimited Control Directory: %s" % (self.fctrl_dir),
                 "FILE_LOCATION")
        return True