Пример #1
0
    def _set_run_dirs(self):
        """
        Sets the relative run directories as instance 
        variables for all runs
        """
        def get_run_number(number):
            return str(number).zfill(5)

        def get_shard_dir(shard_number):
            first_run = self.shard_size * (shard_number - 1) + 1
            last_run = self.shard_size * (shard_number)
            return 'runs-%s-%s' % (get_run_number(first_run),
                                   get_run_number(last_run))

        current_run = 0

        shards = tools.divide_list(self.runs, self.shard_size)

        for shard_number, shard in enumerate(shards, start=1):
            shard_dir = os.path.join(self.base_dir,
                                     get_shard_dir(shard_number))
            tools.overwrite_dir(shard_dir)

            for run in shard:
                current_run += 1
                rel_dir = os.path.join(get_shard_dir(shard_number),
                                       get_run_number(current_run))
                abs_dir = os.path.join(self.base_dir, rel_dir)
                run.dir = abs_dir
Пример #2
0
    def build(self):
        """
        Apply all the actions to the filesystem
        """
        # Make the variables absolute
        self.env_vars = dict([(var, self._get_abs_path(path))
                              for (var, path) in self.env_vars.items()])

        self._set_run_dirs()

        if not self.no_main_script:
            # This is the first part where we only write the main script.
            # We only overwrite the exp dir in the first part.
            tools.overwrite_dir(self.path)
            self._build_main_script()
        if self.only_main_script:
            sys.exit()

        # This is the second part where we write everything else
        self._build_resources()
        self._build_runs()
        self._build_properties_file()

        # Print some instructions for further processing at the end
        self.end_instructions = (self.end_instructions or
                                 self.environment.get_end_instructions(self))
        if self.end_instructions:
            logging.info(self.end_instructions)
Пример #3
0
    def build(self):
        """
        Apply all the actions to the filesystem
        """
        tools.overwrite_dir(self.base_dir)

        self._set_run_dirs()
        self._build_main_script()
        self._build_resources()
        self._build_runs()
Пример #4
0
    def build(self):
        """
        After having made all the necessary adjustments with the methods above,
        this method can be used to write everything to the disk. 
        """
        assert self.dir

        tools.overwrite_dir(self.dir)
        # We need to build the linked resources before the run script.
        # Only this way we have all resources in self.resources (linked ones too)
        self._build_linked_resources()
        self._build_run_script()
        self._build_resources()
        self._build_properties_file()
Пример #5
0
    def build(self):
        """
        After having made all the necessary adjustments with the methods above,
        this method can be used to write everything to the disk.
        """
        assert self.dir

        tools.overwrite_dir(self.dir)
        # We need to build the linked resources before the run script.
        # Only this way we have all resources in self.resources
        # (linked ones too)
        self._build_linked_resources()
        self._build_run_script()
        self._build_resources()
        self._build_properties_file()