Instantiates and performs director job.
 @param [Array] args Opaque list of job arguments that will be used to
   instantiate the new job object.
 @return [void]
325003
def perform_job(*args)
      @task_logger.info('Creating job')

      job = @job_class.new(*args)
      Config.current_job = job

      job.task_id = @task_id
      job.task_checkpoint # cancelled in the queue?

      run_checkpointing

      @task_logger.info("Performing task: #{@task.inspect}")

      @task.timestamp = Time.now
      @task.started_at = Time.now
      @task.checkpoint_time = Time.now
      @task.save

      result = job.perform

      @task_logger.info('Done')
      finish_task(:done, result)

    rescue Bosh::Director::TaskCancelled => e
      log_exception(e)
      @task_logger.info("Task #{@task.id} cancelled")
      finish_task(:cancelled, 'task cancelled')
    rescue Exception => e
      log_exception(e)
      @task_logger.error("#{e}\n#{e.backtrace.join("\n")}")
      finish_task(:error, e)
    end
1307918
def do_job(args)
      @cd = CovData.new
      model_files = process_args args
      usage 'Missed model file', USAGE_INFO if model_files.empty?
      parse_models model_files
      @cd.set_processing_date
      @cd.type = CoverageDataType::TEMPLATE
      @cd.save(@template_file)
    end
94969
def process_args
      args = @args.dup
      @options[:operands] = nil
      unless args.length >= 2
        puts @opts
        exit 1
      end
      @options[:operands] = args.shift(2)
      @options[:output_filename] = args.shift unless args.empty?
      @options[:output] ||= @options[:output_filename] || $stdout

      run
    end
949765
def exec (*args, &block)
      if @scope
        @scope.instance_variables.each do |name|
          instance_variable_set(name, @scope.instance_variable_get(name))
        end
      end

      @ivars.each do |name, value|
        instance_variable_set(name, value)
      end
      
      instance_exec(*args, &block)
    end
387752
function (script, args, hash) {
    this.actionQueue.push(this.webdriverClient.execute.bind(this.webdriverClient, {script: script.toString(), arguments: args}));
    this.actionQueue.push(this._setExecuteCb.bind(this, script.toString(), args, hash));
    return this;
  }
741467
def register_jobs(commands, callable)
      commands.each do |command|
        register_job do
          JobWrapper.call(command,callable)
        end
      end
    end
1409
def add_job(opts={})
      @jobs << Job.new( Parser::Schedule.new(opts[:schedule]), Parser::Command.new(opts[:command]))
    end
489139
def call
      if arguments.valid?
        Qiita::Commands::Request.new(arguments)
      else
        Qiita::Commands::Error.new(arguments)
      end
    end
970038
def make_jobs():
    

    # set up list of arguments
    inputvec = [[3], [5], [10], [20]]

    # create empty job vector
    jobs = []

    # create job objects
    for arg in inputvec:
        # The default queue used by the Job class is all.q. You must specify
        # the `queue` keyword argument if that is not the name of your queue.
        job = Job(compute_factorial, arg, queue='all.q')
        jobs.append(job)

    return jobs
753869
def execute(argv = [], config = {})
      if actions.empty? && !default_command.nil?
        default_command.execute
      else
        actions.each { |a| a.call(argv, config) }
      end
    end
1013613
def dispatch(jobs)
      jobs.map(&method(:check_argument))
      jobs.map(&method(:local_dispatch)) if process_locally?(jobs)
      @processor&.process(jobs, false) unless jobs.length.zero?
      nil
    end
469886
def init_argparser_working_dir(
            self, argparser,
            explanation='',
            help_template=(
                'the working directory; %(explanation)s'
                'default is current working directory (%(cwd)s)'),
            ):
        

        cwd = self.toolchain.join_cwd()
        argparser.add_argument(
            '--working-dir', dest=WORKING_DIR,
            metavar=metavar(WORKING_DIR),
            default=cwd,
            help=help_template % {'explanation': explanation, 'cwd': cwd},
        )
1200622
def cli_create(argument_list):
    

    parser = argparse.ArgumentParser()
    parser.add_argument("content", help="file or directory")
    # TODO: shouldn't we always process directories recursively?
    parser.add_argument("-r", "--recursive",
                        help="process directories recursively")
    parser.add_argument("-i", "--ignore", nargs="+", action="append",
                        help="patterns to ignore "
                             "(can be given more than once)")
    parser.add_argument("-m", "--manifest", default=None,
                        help="output file (default is stdout)")
    parser.add_argument("-d", "--digest",
                        help="digest(s) to use, comma-separated")

    args = parser.parse_args(argument_list)

    # TODO: remove digest from here, they are created when signing!
    if args.digest is None:
        args.digest = "MD5,SHA1"
    requested_digests = args.digest.split(",")
    use_digests = [_get_digest(digest) for digest in requested_digests]

    if args.recursive:
        entries = multi_path_generator(args.content)
    else:
        entries = single_path_generator(args.content)

    mf = Manifest()

    ignores = ["META-INF/*"]
    if args.ignore:
        ignores.extend(*args.ignore)

    for name, chunks in entries:
        # skip the stuff that we were told to ignore
        if ignores and fnmatches(name, *ignores):
            continue

        sec = mf.create_section(name)

        digests = zip(requested_digests, digest_chunks(chunks(), use_digests))
        for digest_name, digest_value in digests:
            sec[digest_name + "-Digest"] = digest_value

    if args.manifest:
        # we'll output to the manifest file if specified, and we'll
        # even create parent directories for it, if necessary
        makedirsp(split(args.manifest)[0])
        output = open(args.manifest, "wb")
    else:
        output = sys.stdout

    mf.store(output)

    if args.manifest:
        output.close()
506460
def create_commands_map
      # Require all the ruby command files
      command_file_paths.each do |file|
        require file

        # Get basename for the file without the extension
        basename = get_basename_from_file(file)

        # Camelcase the basename to be the klass name
        klass_name = camelize(basename)

        # return the command klass for this klass_name
        command_klass = Conify::Command.const_get(klass_name)

        # For each of the user-defined methods inside this class, create a command for it
        manually_added_methods(command_klass).each { |method|
          register_command(basename, method.to_s, command_klass, global: basename == 'global')
        }
      end
    end
918879
public static void main(String[] args
                          ) throws ClassNotFoundException, IOException, 
                                   InterruptedException {
    if (args.length != 1) {
      System.out.println("Usage: IsolationRunner <path>/job.xml");
      System.exit(1);
    }
    File jobFilename = new File(args[0]);
    if (!jobFilename.exists() || !jobFilename.isFile()) {
      System.out.println(jobFilename + " is not a valid job file.");
      System.exit(1);
    }
    JobConf conf = new JobConf(new Path(jobFilename.toString()));
    TaskAttemptID taskId = TaskAttemptID.forName(conf.get("mapred.task.id"));
    boolean isMap = conf.getBoolean("mapred.task.is.map", true);
    int partition = conf.getInt("mapred.task.partition", 0);
    
    // setup the local and user working directories
    FileSystem local = FileSystem.getLocal(conf);
    LocalDirAllocator lDirAlloc = new LocalDirAllocator("mapred.local.dir");
    File workDirName = new File(lDirAlloc.getLocalPathToRead(
                                  TaskTracker.getLocalTaskDir(
                                    taskId.getJobID().toString(), 
                                    taskId.toString())
                                  + Path.SEPARATOR + "work",
                                  conf). toString());
    local.setWorkingDirectory(new Path(workDirName.toString()));
    FileSystem.get(conf).setWorkingDirectory(conf.getWorkingDirectory());
    
    // set up a classloader with the right classpath
    ClassLoader classLoader = makeClassLoader(conf, workDirName);
    Thread.currentThread().setContextClassLoader(classLoader);
    conf.setClassLoader(classLoader);
    
    Task task;
    if (isMap) {
      Path localSplit = new Path(new Path(jobFilename.toString()).getParent(), 
                                 "split.dta");
      DataInputStream splitFile = FileSystem.getLocal(conf).open(localSplit);
      String splitClass = Text.readString(splitFile);
      BytesWritable split = new BytesWritable();
      split.readFields(splitFile);
      splitFile.close();
      task = new MapTask(jobFilename.toString(), taskId, partition, 
                         splitClass, split, 1, conf.getUser());
    } else {
      int numMaps = conf.getNumMapTasks();
      fillInMissingMapOutputs(local, taskId, numMaps, conf);
      task = new ReduceTask(jobFilename.toString(), taskId, partition, numMaps, 
                            1, conf.getUser());
    }
    task.setConf(conf);
    task.run(conf, new FakeUmbilical());
  }
1249377
public static void main(final String[] args) throws InjectionException, IOException {
    Validate.isTrue(args.length == 4, "Job resource uploader requires 4 args");
    final File localFile = new File(args[0]);
    Validate.isTrue(localFile.exists(), "Local file does not exist " + localFile.getAbsolutePath());
    final String fileType = args[1];
    final String jobSubmissionDirectory = args[2];
    final String localOutputPath = args[3];

    LOG.log(Level.INFO, "Received args: LocalPath " + localFile.getAbsolutePath() + " Submission directory " +
        jobSubmissionDirectory + " LocalOutputPath " + localOutputPath);
    final Configuration configuration = Tang.Factory.getTang().newConfigurationBuilder()
        .bindImplementation(RuntimeClasspathProvider.class, YarnClasspathProvider.class)
        .bindConstructor(org.apache.hadoop.yarn.conf.YarnConfiguration.class, YarnConfigurationConstructor.class)
        .build();

    final JobUploader jobUploader = Tang.Factory.getTang()
        .newInjector(configuration)
        .getInstance(JobUploader.class);
    final LocalResource localResource = jobUploader.createJobFolder(jobSubmissionDirectory)
        .uploadAsLocalResource(localFile, LocalResourceType.valueOf(fileType));

    // Output: <UploadedPath>;<LastModificationUnixTimestamp>;<ResourceSize>
    final URL resource = localResource.getResource();
    final String outputString = String.format("%s://%s:%d%s;%d;%d", resource.getScheme(), resource.getHost(),
        resource.getPort(), resource.getFile(), localResource.getTimestamp(), localResource.getSize());
    LOG.log(Level.INFO, "Writing output: " + outputString);
    try (Writer writer = new BufferedWriter(new OutputStreamWriter(
      new FileOutputStream(localOutputPath), "utf-8"))) {
      writer.write(outputString);
    }

    LOG.log(Level.FINER, "Done writing output file");
  }
284585
def do_execute(self):
        
        self.first_active.input = self.input
        result = self._director.execute()
        if result is None:
            self._output.append(self.input)
        return result