Runs a swarm with data within a working directory. This assumes that the 
    user has already run prepareSwarm().
    :param workingDirPath: absolute or relative path to working directory
160801
def runSwarm(self, workingDirPath):
    
    if not os.path.exists(workingDirPath):
      raise Exception("Working directory %s does not exist!" % workingDirPath)
    banner("RUNNING SWARM")
    self._modelParams = swarm(workingDirPath)
511867
def run(self):
        
        from zengine.wf_daemon import run_workers, Worker

        worker_count = int(self.manager.args.workers or 1)
        if not self.manager.args.daemonize:
            print("Starting worker(s)")

        if worker_count > 1 or self.manager.args.autoreload:
            run_workers(worker_count,
                        self.manager.args.paths.split(' '),
                        self.manager.args.daemonize)
        else:
            worker = Worker()
            worker.run()
504386
private void setWorkingDir(String[] args) throws FileNotFoundException {
    String workDir = null;
    // skip first node type argument (locator/server/lead)
    for (int i = 1; i < args.length; i++) {
      String arg = args[i];
      if (arg.startsWith(DIR_OPT)) {
        workDir = arg.substring(DIR_OPT.length());
      } else if (!arg.equalsIgnoreCase("stop") &&
          !arg.equalsIgnoreCase("status") &&
          !arg.equalsIgnoreCase("wait") &&
          !arg.equalsIgnoreCase("verbose")) {
        throw new IllegalArgumentException(
            MessageFormat.format(LAUNCHER_UNKNOWN_ARGUMENT, arg));
      }
    }
    processDirOption(workDir);
  }
738979
@Override
  public void setWorkingDirectory(Path hadoopPath) {
    long startTime = System.nanoTime();
    Preconditions.checkArgument(hadoopPath != null, "hadoopPath must not be null");

    logger.atFine().log("GHFS.setWorkingDirectory: %s", hadoopPath);
    URI gcsPath = FileInfo.convertToDirectoryPath(pathCodec, getGcsPath(hadoopPath));
    Path newPath = getHadoopPath(gcsPath);

    // Ideally we should check (as we did earlier) if the given path really points to an existing
    // directory. However, it takes considerable amount of time for that check which hurts perf.
    // Given that HDFS code does not do such checks either, we choose to not do them in favor of
    // better performance.

    workingDirectory = newPath;
    logger.atFine().log("GHFS.setWorkingDirectory: => %s", workingDirectory);

    long duration = System.nanoTime() - startTime;
    increment(Counter.SET_WD);
    increment(Counter.SET_WD_TIME, duration);
  }
845172
def run_task(_verbose)
      data.each do |path, string|
        opts = {}
        path = File.expand_path(path)

        if string.is_a?(Hash)
          input             = string[:input]
          opts[:patterns]   = string[:patterns] if string.key? :patterns
          opts[:color]      = string[:color] if string.key? :color
          opts[:base_color] = string[:base_color] if string.key? :base_color
        else
          raise 'Invalid data structure for Rake Task'
        end

        pattern = GeoPattern.generate(input, opts)

        logger.info "Creating pattern at \"#{path}\"."
        FileUtils.mkdir_p File.dirname(path)
        File.write(path, pattern.to_svg)
      end
    end
413217
def runpath(path, argv, filename=None, threads=True, verbose=False):
    
    _run(threads, verbose, 'runpath', filename, path, argv)
864569
protected void prepareRootDir(String rootDirPath) throws IOException, RepositoryConfigurationException
   {
      this.rootDir = new File(rootDirPath);

      if (!rootDir.exists())
      {
         if (rootDir.mkdirs())
         {
            LOG.info("Value storage directory created: " + rootDir.getAbsolutePath());
            
            // create internal temp dir
            File tempDir = new File(rootDir, TEMP_DIR_NAME);
            tempDir.mkdirs();

            if (tempDir.exists() && tempDir.isDirectory())
            {
               // care about storage temp dir cleanup
               for (File tmpf : tempDir.listFiles())
                  if (!tmpf.delete())
                     LOG.warn("Storage temporary directory contains un-deletable file " + tmpf.getAbsolutePath()
                        + ". It's recommended to leave this directory for JCR External Values Storage private use.");
            }
            else
               throw new RepositoryConfigurationException("Cannot create " + TEMP_DIR_NAME
                  + " directory under External Value Storage.");
         }
         else
         {
            LOG.warn("Directory IS NOT created: " + rootDir.getAbsolutePath());
         }
      }
      else
      {
         if (!rootDir.isDirectory())
         {
            throw new RepositoryConfigurationException("File exists but is not a directory " + rootDirPath);
         }
      }
   }
943677
private void startupWatchdir() throws Exception {
		File dirToWatch;
		if (this.configuration.getProcessConfigDirOrFile().isFile()) {
			dirToWatch = new File(FilenameUtils.getFullPath(this.configuration.getProcessConfigDirOrFile().getAbsolutePath()));
		} else {
			dirToWatch = this.configuration.getProcessConfigDirOrFile();
		}

		// start the watcher
		this.watcher = new WatchDir(dirToWatch, this);
		this.watcher.start();
	}
832049
def set_working_directory(self, dirname):
        
        if dirname:
            self.main.workingdirectory.chdir(dirname, refresh_explorer=True,
                                             refresh_console=False)
105038
def _set_WorkingDir(self, path):
        
        self._curr_working_dir = path
        try:
            mkdir(self.WorkingDir)
        except OSError:
            # Directory already exists
            pass
672111
def update_jobdir(self, site):
        
        working_path = self.cfg.get_working_path()
        if not working_path.endswith("/"):
            working_path += "/"
        jobdirname = self.__scrapy_options["JOBDIRNAME"]
        if not jobdirname.endswith("/"):
            jobdirname += "/"

        site_string = ''.join(site["url"]) + self.crawler_name
        hashed = hashlib.md5(site_string.encode('utf-8'))

        self.__scrapy_options["JOBDIR"] = working_path + jobdirname + hashed.hexdigest()
739894
def run(filepath, wsgiapp, host, port, reload, interval,
        static, static_root, static_dirs, lineprof, lineprof_file, validate):
    
    insert_import_path_to_sys_modules(filepath)
    module = SourceFileLoader('module', filepath).load_module()
    app = getattr(module, wsgiapp)

    if static:
        from wsgi_static_middleware import StaticMiddleware
        app = StaticMiddleware(app, static_root=static_root, static_dirs=static_dirs)

    if validate:
        from wsgiref.validate import validator
        app = validator(app)

    if lineprof:
        # Caution: wsgi-lineprof is still pre-alpha. Except breaking API Changes.
        from wsgi_lineprof.middleware import LineProfilerMiddleware
        from wsgi_lineprof.filters import FilenameFilter, TotalTimeSorter

        if lineprof_file:
            # Now wsgi-lineprof is now supported only 1 file checking.
            lineprof_file = lineprof_file[0]
        else:
            lineprof_file = os.path.basename(filepath)
        filters = [FilenameFilter(lineprof_file), TotalTimeSorter()]
        app = LineProfilerMiddleware(app, filters=filters)

    if reload:
        run_live_reloading_server(interval, app=app, host=host, port=port)
    else:
        run_server(app=app, host=host, port=port)
40842
def build_process_isolation_temp_dir(self):
        '''
        
        '''
        path = tempfile.mkdtemp(prefix='ansible_runner_pi_', dir=self.process_isolation_path)
        os.chmod(path, stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR)
        atexit.register(shutil.rmtree, path)
        return path
1071892
def set_workdir(self, workdir, chroot=False):
        
        if not chroot and hasattr(self, "workdir") and self.workdir != workdir:
            raise ValueError("self.workdir != workdir: %s, %s" % (self.workdir,  workdir))

        # Directories with (input|output|temporary) data.
        self.workdir = os.path.abspath(workdir)
        self.indir = Directory(os.path.join(self.workdir, "indata"))
        self.outdir = Directory(os.path.join(self.workdir, "outdata"))
        self.tmpdir = Directory(os.path.join(self.workdir, "tmpdata"))
        self.wdir = Directory(self.workdir)
296340
def create_working_dir(config, prefix):
    '''
        
    '''
    # Fetch base directory from executor configuration
    basepath = config.get("Execution", "directory")

    if not prefix:
        prefix = 'opensubmit'

    finalpath = tempfile.mkdtemp(prefix=prefix + '_', dir=basepath)
    if not finalpath.endswith(os.sep):
        finalpath += os.sep
    logger.debug("Created fresh working directory at {0}.".format(finalpath))

    return finalpath
1120743
def run(self, input_dir, output_file_path):
    
    logging.info('Running defense %s', self.submission_id)
    tmp_run_dir = self.temp_copy_extracted_submission()
    output_dir = os.path.dirname(output_file_path)
    output_filename = os.path.basename(output_file_path)
    cmd = ['--network=none',
           '-m=24g',
           '--cpus=3.75',
           '-v', '{0}:/input_images:ro'.format(input_dir),
           '-v', '{0}:/output_data'.format(output_dir),
           '-v', '{0}:/code'.format(tmp_run_dir),
           '-w', '/code',
           self.container_name,
           './' + self.entry_point,
           '/input_images',
           '/output_data/' + output_filename]
    elapsed_time_sec = self.run_with_time_limit(cmd)
    sudo_remove_dirtree(tmp_run_dir)
    return elapsed_time_sec
1097271
def run(self):
        

        result = {
            'help_file': self.help_file,
            'status': None
        }

        help_path = os.path.join(self.workflow.builder.df_dir, self.help_file)

        if not os.path.exists(help_path):
            self.log.info("File %s not found", help_path)
            result['status'] = self.NO_HELP_FILE_FOUND
            return result

        dockerfile = df_parser(self.workflow.builder.df_path, workflow=self.workflow)
        labels = Labels(dockerfile.labels)
        try:
            _, name = labels.get_name_and_value(Labels.LABEL_TYPE_NAME)
        except KeyError:
            name = ''
        maintainer = dockerfile.labels.get('maintainer', '')

        with open(help_path, 'r+') as help_file:
            lines = help_file.readlines()

            if not lines[0].startswith("% "):
                lines.insert(0, "%% %s (1) Container Image Pages\n" % name)
                lines.insert(1, "%% %s\n" % maintainer)
                lines.insert(2, "%% %s\n" % dt.fromtimestamp(atomic_reactor_start_time)
                             .strftime(format="%B %-d, %Y"))

                help_file.seek(0)
                help_file.truncate()
                help_file.writelines(lines)

                self.log.info("added metadata to %s for generating nicer manpages", help_path)

        man_path = os.path.join(self.workflow.builder.df_dir, self.man_filename)

        go_md2man_cmd = ['go-md2man', '-in={}'.format(help_path), '-out={}'.format(man_path)]

        try:
            check_output(go_md2man_cmd, stderr=STDOUT)
        except OSError as e:
            if e.errno == errno.ENOENT:
                raise RuntimeError(
                    "Help file is available, but go-md2man is not present in a buildroot")

            raise
        except CalledProcessError as e:
            raise RuntimeError("Error running %s: %r, exit code: %s, output: '%s'" % (
                e.cmd, e, e.returncode, e.output))

        if not os.path.exists(man_path):
            raise RuntimeError("go-md2man run complete, but man file is not found")

        # Include the help file in the docker file

        lines = dockerfile.lines

        content = 'ADD {0} /{0}'.format(self.man_filename)
        # put it before last instruction
        lines.insert(-1, content + '\n')

        dockerfile.lines = lines

        self.log.info("added %s", man_path)

        result['status'] = self.HELP_GENERATED
        return result