Walk the directory and builds pre-calculation reports for all the
    job.ini files found.
3826
def do_build_reports(directory):
    
    for cwd, dirs, files in os.walk(directory):
        for f in sorted(files):
            if f in ('job.ini', 'job_h.ini', 'job_haz.ini', 'job_hazard.ini'):
                job_ini = os.path.join(cwd, f)
                logging.info(job_ini)
                try:
                    reportwriter.build_report(job_ini, cwd)
                except Exception as e:
                    logging.error(str(e))
1318573
def _walk_through(job_dir):
    '''
    
    '''
    serial = salt.payload.Serial(__opts__)

    for top in os.listdir(job_dir):
        t_path = os.path.join(job_dir, top)

        if not os.path.exists(t_path):
            continue

        for final in os.listdir(t_path):
            load_path = os.path.join(t_path, final, LOAD_P)

            if not os.path.isfile(load_path):
                continue

            with salt.utils.files.fopen(load_path, 'rb') as rfh:
                try:
                    job = serial.load(rfh)
                except Exception:
                    log.exception('Failed to deserialize %s', load_path)
                    continue
                if not job:
                    log.error('Deserialization of job succeded but there is no data in %s', load_path)
                    continue
                jid = job['jid']
                yield jid, job, t_path, final
327456
def build(self, output_path=""):
        """"""

        self.output_path = self.checkOutputPath(output_path)
        self._buildStaticFiles()
        self.final_url = self._buildTemplates()
        printDebug("Done.", "comment")
        printDebug("=> %s" % (self.final_url), "comment")
        return self.final_url
415115
def pre_build #:nodoc:
            load!

            prolog = ""
            data = ""
            objoff = 0
            @objects.to_a.sort.each do |num,obj|

                obj.set_indirect(false)
                obj.objstm_offset = objoff

                prolog << "#{num} #{objoff} "
                objdata = "#{obj} "

                objoff += objdata.size
                data << objdata
                obj.set_indirect(true)
                obj.no = num
            end

            self.data = prolog + data

            @dictionary[:N] = @objects.size
            @dictionary[:First] = prolog.size

            super
        end
601853
private function buildMigrations()
    {
        $unitDataArray = $this->loadUnitDataIteratorFromDatabase();
        foreach ($unitDataArray as $unitData) {
            $unitOfWork = UnitOfWorkFactory::BuildFromFlatArray($unitData);
            $this->presentUidsOnConstruction[$unitOfWork->getUniqueId()] = true;
            $this->add($unitOfWork);
        }
    }
897361
def build!
      create_output_directory
      spec.source_directories.each { |d| simple_compile_directory(d) }
      compile_files(spec.all_javascript_paths)
      compile_files(spec.all_stylesheet_paths)
      write_manifest
    end
853517
def setup_directories(builddir):
    """"""
    build_dir = local.path(builddir)
    in_dir = build_dir / "container-in"
    out_dir = build_dir / "container-out"

    if not in_dir.exists():
        in_dir.mkdir()
    if not out_dir.exists():
        out_dir.mkdir()
496163
def build_job_configs(self, args):
        
        job_configs = {}

        components = Component.build_from_yamlfile(args['comp'])
        NAME_FACTORY.update_base_dict(args['data'])

        ret_dict = make_diffuse_comp_info_dict(components=components,
                                               library=args['library'],
                                               basedir=NAME_FACTORY.base_dict['basedir'])
        diffuse_comp_info_dict = ret_dict['comp_info_dict']

        for diffuse_comp_info_key in sorted(diffuse_comp_info_dict.keys()):
            diffuse_comp_info_value = diffuse_comp_info_dict[diffuse_comp_info_key]

            for comp in components:
                zcut = "zmax%i" % comp.zmax
                key = comp.make_key('{ebin_name}_{evtype_name}')
                if diffuse_comp_info_value.components is None:
                    sub_comp_info = diffuse_comp_info_value
                else:
                    sub_comp_info = diffuse_comp_info_value.get_component_info(comp)
                name_keys = dict(zcut=zcut,
                                 sourcekey=sub_comp_info.sourcekey,
                                 ebin=comp.ebin_name,
                                 psftype=comp.evtype_name,
                                 mktime='none',
                                 coordsys=comp.coordsys,
                                 irf_ver=NAME_FACTORY.irf_ver(),
                                 fullpath=True)

                outfile = NAME_FACTORY.srcmaps(**name_keys)
                outfile_tokens = os.path.splitext(outfile)
                infile_regexp = "%s_*.fits*" % outfile_tokens[0]
                full_key = "%s_%s" % (sub_comp_info.sourcekey, key)
                logfile = make_nfs_path(outfile.replace('.fits', '.log'))
                job_configs[full_key] = dict(output=outfile,
                                             args=infile_regexp,
                                             hdu=sub_comp_info.source_name,
                                             logfile=logfile)

        return job_configs
234581
def run_init(args):
    
    root = args.root
    if root is None:
        root = '.'
    root = os.path.abspath(root)

    project_data = _get_package_data()
    project_name = project_data['project_name']

    directories = [os.path.join(root, 'bin'),
                   os.path.join(root, 'docs'),
                   os.path.join(root, 'tests'),
                   os.path.join(root, project_name),
                   ]
    for dir_path in directories:
        if not os.path.exists(dir_path):
            os.makedirs(dir_path)

    script_paths = [os.path.join(root, 'README.md'),
                    os.path.join(root, 'tests/__init__.py'),
                    ]
    for script_path in script_paths:
        if not os.path.exists(script_path):
            os.mknod(script_path)

    copy_samples = [(resource_filename('mpu', 'package/templates/tox.ini.txt'),
                     os.path.join(root, 'tox.ini')),
                    (resource_filename('mpu',
                                       'package/templates/setup.cfg.txt'),
                     os.path.join(root, 'setup.cfg')),
                    (resource_filename('mpu',
                                       'package/templates/setup.py.txt'),
                     os.path.join(root, 'setup.py')),
                    (resource_filename('mpu',
                                       'package/templates/_version.py.txt'),
                     os.path.join(root, project_name + '/_version.py')),
                    (resource_filename('mpu',
                                       'package/templates/coveragerc.txt'),
                     os.path.join(root, '.coveragerc')),
                    (resource_filename('mpu', 'package/templates/init.py.txt'),
                     os.path.join(root, project_name + '/__init__.py')),
                    ]
    translate = {'[[project_name]]': project_data['project_name'],
                 '[[license]]': project_data['license'],
                 '[[author]]': project_data['author'],
                 '[[email]]': project_data['email'],
                 }
    for source, destination in copy_samples:
        if not os.path.exists(destination):
            copyfile(source, destination)
            _adjust_template(destination, translate)
1352441
def _prepare_job(request, candidates):
    
    temp_dir = tempfile.mkdtemp()
    inifiles = []
    arch = request.FILES.get('archive')
    if arch is None:
        # move each file to a new temp dir, using the upload file names,
        # not the temporary ones
        for each_file in request.FILES.values():
            new_path = os.path.join(temp_dir, each_file.name)
            shutil.move(each_file.temporary_file_path(), new_path)
            if each_file.name in candidates:
                inifiles.append(new_path)
        return inifiles
    # else extract the files from the archive into temp_dir
    return readinput.extract_from_zip(arch, candidates)
1086574
def _find_logs(self, compile_workunit):
    """"""
    for idx, workunit in enumerate(compile_workunit.children):
      for output_name, outpath in workunit.output_paths().items():
        if output_name in ('stdout', 'stderr'):
          yield idx, workunit.name, output_name, outpath
1108238
def add_files(self, working_tree, report=False):
        
        blacklist = ['.git']

        def add_resursiv(path = '.', report=report):
            if os.path.basename(path) in blacklist:
                return 0, 0

            if working_tree + '/aetros' == path:
                # ignore in work_tree the folder ./aetros/, as it could be
                # that we checked out a job and start it again.
                return 0, 0

            if os.path.isdir(path):
                files = 0
                size = 0
                for file in os.listdir(path):
                    if path and path != '.':
                        file = path + '/' + file

                    added_files, added_size = add_resursiv(file)
                    files += added_files
                    size += added_size

                return files, size
            else:
                if path.endswith('.pyc'):
                    return 0, 0

                relative_path = os.path.relpath(path, working_tree)

                if is_ignored(relative_path, self.config['ignore']):
                    return 0, 0

                self.logger.debug("added file to job " + relative_path)
                if report:
                    print("Added job file: " + relative_path)

                self.git.add_file_path_in_work_tree(path, working_tree, verbose=False)

                return 1, os.path.getsize(path)

        return add_resursiv(working_tree, report=report)
948133
function initJobDirs(branchBase, job, cache, done) {
  var dirs = {
    base: branchBase,
    data: path.join(branchBase, `job-${job._id.toString()}`),
    cache: cache
  };

  async.series([
    function checkData(next) {
      fs.exists(dirs.data, function (exists) {
        if (!exists) return next();
        fs.remove(dirs.data, function () {
          next();
        });
      });
    },
    fs.mkdirp.bind(null, dirs.data),
    fs.mkdirp.bind(null, dirs.cache)
  ], function (err) {
    done(err, dirs);
  });
}
832532
def build_job_configs(self, args):
        
        job_configs = {}

        ttype = args['ttype']
        (sim_targets_yaml, sim) = NAME_FACTORY.resolve_targetfile(args)
        targets = load_yaml(sim_targets_yaml)

        base_config = dict(ttype=ttype,
                           roi_baseline=args['roi_baseline'],
                           extracopy = args['extracopy'],
                           sim=sim)

        for target_name in targets.keys():
            targetdir = NAME_FACTORY.sim_targetdir(target_type=ttype,
                                                   target_name=target_name,
                                                   sim_name=sim)
            logfile = os.path.join(targetdir, 'copy_base_dir.log')
            job_config = base_config.copy()
            job_config.update(dict(target=target_name,
                                   logfile=logfile))
            job_configs[target_name] = job_config

        return job_configs
1318349
def write_functions(self):
        '''
        
        '''

        # toil cannot technically start with multiple jobs, so an empty
        # 'initialize_jobs' function is always called first to get around this
        fn_section = 'def initialize_jobs(job):\n' + \
                     '    job.fileStore.logToMaster("initialize_jobs")\n'

        for job in self.tasks_dictionary:
            fn_section += self.write_function(job)

        for wf in self.workflows_dictionary:
            for assignment in self.workflows_dictionary[wf]:
                if assignment.startswith('scatter'):
                    fn_section += self.write_scatterfunction(self.workflows_dictionary[wf][assignment], assignment)
                if assignment.startswith('if'):
                    fn_section += self.write_scatterfunctions_within_if(self.workflows_dictionary[wf][assignment]['body'])

        return fn_section
1263167
def finalize_options(self):
        
        self.cwd = os.path.abspath(os.path.dirname(__file__))
        self.build_dirs = [
            os.path.join(self.cwd, 'build'),
            os.path.join(self.cwd, 'htmlcov'),
            os.path.join(self.cwd, 'dist'),
            os.path.join(self.cwd, 'pylink_square.egg-info')
        ]
        self.build_artifacts = ['.pyc', '.o', '.elf', '.bin']
452312
public function preBuild()
    {
        $build_path = $this->getBuildPath();

        if ($build_path) {
            if (is_dir($build_path)) {
                $build_path = rtrim($build_path, DIRECTORY_SEPARATOR);

                if (!is_dir("$build_path/Manager/Base")) {
                    $old_umask = umask(0);
                    $dir_created = mkdir("$build_path/Manager/Base");
                    umask($old_umask);

                    if ($dir_created) {
                        $this->triggerEvent('on_dir_created', ["$build_path/Manager/Base"]);
                    } else {
                        throw new RuntimeException("Failed to create '$build_path/Manager/Base' directory");
                    }
                }
            } else {
                throw new InvalidArgumentException("Directory '$build_path' not found");
            }
        }
    }