The starting point of the evaluator shim launcher.
175268
public static void main(final String[] args) throws Exception {
    LOG.log(Level.INFO, "Entering EvaluatorShimLauncher.main().");

    final Injector injector = Tang.Factory.getTang().newInjector(parseCommandLine(args));
    final EvaluatorShimLauncher launcher = injector.getInstance(EvaluatorShimLauncher.class);
    launcher.launch();
  }
116290
def main(self):
        
        try:
            # Start the daemon
            if not self.verify_only and not self.do_daemon_init_and_start():
                self.exit_on_error(message="Daemon initialization error", exit_code=3)

            if self.verify_only:
                self.setup_alignak_logger()

            # Load monitoring configuration files
            self.load_monitoring_config_file()

            # Set my own process title
            self.set_proctitle(self.name)

            # Now we can start our "external" modules (if any):
            self.modules_manager.start_external_instances()

            # Now we can load the retention data
            self.hook_point('load_retention')

            # And go for the main loop
            while True:
                self.do_main_loop()
                logger.info("Exited from the main loop.")

                # Exiting the main loop because of a configuration reload
                if not self.need_config_reload:
                    # If no configuration reload is required, stop the arbiter daemon
                    self.request_stop()
                else:
                    # Loop if a configuration reload is raised while
                    # still reloading the configuration
                    while self.need_config_reload:
                        # Clear the former configuration
                        self.need_config_reload = False
                        self.link_to_myself = None
                        self.conf = Config()
                        # Load monitoring configuration files
                        _ts = time.time()
                        logger.warning('--- Reloading configuration...')
                        self.load_monitoring_config_file()
                        duration = int(time.time() - _ts)
                        self.add(make_monitoring_log('info', 'CONFIGURATION RELOAD;%d' % duration))
                        logger.warning('--- Configuration reloaded, %d seconds', duration)

                        # Make a pause to let our satellites get ready...
                        pause = max(1, self.conf.daemons_new_conf_timeout)
                        if pause:
                            logger.info("Pausing %.2f seconds...", pause)
                            time.sleep(pause)

        except Exception as exp:  # pragma: no cover, this should never happen indeed ;)
            # Only a master arbiter can stop the daemons
            if self.is_master:
                # Stop the daemons
                self.daemons_stop(timeout=self.conf.daemons_stop_timeout)
            self.exit_on_exception(raised_exception=exp)
            raise
1365412
def buildWorkbenchWithLauncher():
    
    workbench = ui.Workbench()

    tools = [exercises.SearchTool()]
    launcher = ui.Launcher(workbench, tools)
    workbench.display(launcher)

    return workbench, launcher
419666
def main(args):
  """"""
  random.seed()
  temp_dir = tempfile.mkdtemp()
  logging.info('Created temporary directory: %s', temp_dir)
  validator = SubmissionValidator(
      source_dir=args.source_dir,
      target_dir=args.target_dir,
      temp_dir=temp_dir,
      do_copy=args.copy,
      use_gpu=args.use_gpu,
      containers_file=args.containers_file)
  validator.run()
  logging.info('Deleting temporary directory: %s', temp_dir)
  subprocess.call(['rm', '-rf', temp_dir])
52524
def main(args):
  """"""
  if args.blacklisted_submissions:
    logging.warning('BLACKLISTED SUBMISSIONS: %s',
                    args.blacklisted_submissions)
  if args.limited_dataset:
    logging.info('Using limited dataset: 3 batches * 10 images')
    max_dataset_num_images = 30
    batch_size = 10
  else:
    logging.info('Using full dataset. Batch size: %d', DEFAULT_BATCH_SIZE)
    max_dataset_num_images = None
    batch_size = DEFAULT_BATCH_SIZE
  random.seed()
  print('\nRound: {0}\n'.format(args.round_name))
  eval_master = EvaluationMaster(
      storage_client=eval_lib.CompetitionStorageClient(
          args.project_id, args.storage_bucket),
      datastore_client=eval_lib.CompetitionDatastoreClient(
          args.project_id, args.round_name),
      round_name=args.round_name,
      dataset_name=args.dataset_name,
      blacklisted_submissions=args.blacklisted_submissions,
      results_dir=args.results_dir,
      num_defense_shards=args.num_defense_shards,
      verbose=args.verbose,
      batch_size=batch_size,
      max_dataset_num_images=max_dataset_num_images)
  if args.command == 'attack':
    eval_master.prepare_attacks()
  elif args.command == 'defense':
    eval_master.prepare_defenses()
  elif args.command == 'cleanup_defenses':
    eval_master.cleanup_defenses()
  elif args.command == 'results':
    eval_master.compute_results()
  elif args.command == 'status':
    eval_master.show_status()
  elif args.command == 'cleanup_datastore':
    eval_master.cleanup_datastore()
  elif args.command == 'cleanup_failed_attacks':
    eval_master.cleanup_failed_attacks()
  elif args.command == 'cleanup_attacks_with_zero_images':
    eval_master.cleanup_attacks_with_zero_images()
  else:
    print('Invalid command: ', args.command)
    print('')
    print(USAGE)
752546
def main():
    """"""
    desc = 'Generate files to benchmark'
    parser = argparse.ArgumentParser(description=desc)
    parser.add_argument(
        '--src',
        dest='src_dir',
        default='src',
        help='The directory containing the templates'
    )
    parser.add_argument(
        '--out',
        dest='out_dir',
        default='generated',
        help='The output directory'
    )
    parser.add_argument(
        '--seed',
        dest='seed',
        default='13',
        help='The random seed (to ensure consistent regeneration)'
    )

    args = parser.parse_args()

    random.seed(int(args.seed))

    mkdir_p(args.out_dir)

    for template in templates_in(args.src_dir):
        modes = template.modes()

        n_range = template.range()
        for n_value in n_range:
            base = template.instantiate(n_value)
            for mode in modes:
                write_file(
                    os.path.join(
                        args.out_dir,
                        out_filename(template, n_value, mode)
                    ),
                    mode.convert_from(base)
                )
        write_file(
            os.path.join(args.out_dir, '{0}.json'.format(template.name)),
            json.dumps({
                'files': {
                    n: {
                        m.identifier: out_filename(template, n, m)
                        for m in modes
                    } for n in n_range
                },
                'name': template.name,
                'x_axis_label': template.property('x_axis_label'),
                'desc': template.property('desc'),
                'modes': {m.identifier: m.description() for m in modes}
            })
        )
787053
def main(args=sys.argv):
    
    try:
        tarball = "--no-tarball" not in args
        # Set up logging.
        logging.basicConfig(level=logging.WARN)
        work_dir = args[1]
        assert os.path.exists(work_dir), "First argument to sge_runner.py must be a directory that exists"
        project_dir = args[2]
        sys.path.append(project_dir)
        _do_work_on_compute_node(work_dir, tarball)
    except Exception as e:
        # Dump encoded data that we will try to fetch using mechanize
        print(e)
        raise
111502
public static void main(final String[] args) throws Exception {

    WhiskasDemo demo = new WhiskasDemo();

    demo.setUp();

    while (true) {
      demo.sequentialRead();
      demo.randomRead();
    }
  }
1259413
private VirtualMachine launchTarget() {
        LaunchingConnector launcher = (LaunchingConnector) connector;
        try {
            VirtualMachine new_vm = timedVirtualMachineCreation(() -> launcher.launch(connectorArgs), null);
            process = new_vm.process();
            return new_vm;
        } catch (Throwable ex) {
            throw reportLaunchFail(ex, "launch");
        }
    }
430671
def main():
    """"""
    # Initialization variables - update to change your model and execution context
    model_prefix = "FCN8s_VGG16"
    epoch = 19

    # By default, MXNet will run on the CPU. Change to ctx = mx.gpu() to run on GPU.
    ctx = mx.cpu()

    fcnxs, fcnxs_args, fcnxs_auxs = mx.model.load_checkpoint(model_prefix, epoch)
    fcnxs_args["data"] = mx.nd.array(get_data(args.input), ctx)
    data_shape = fcnxs_args["data"].shape
    label_shape = (1, data_shape[2]*data_shape[3])
    fcnxs_args["softmax_label"] = mx.nd.empty(label_shape, ctx)
    exector = fcnxs.bind(ctx, fcnxs_args, args_grad=None, grad_req="null", aux_states=fcnxs_args)
    exector.forward(is_train=False)
    output = exector.outputs[0]
    out_img = np.uint8(np.squeeze(output.asnumpy().argmax(axis=1)))
    out_img = Image.fromarray(out_img)
    out_img.putpalette(get_palette())
    out_img.save(args.output)
114476
public static LauncherStatus launchLocal(final VortexJobConf vortexConf) {
    final Configuration runtimeConf = LocalRuntimeConfiguration.CONF
        .set(LocalRuntimeConfiguration.MAX_NUMBER_OF_EVALUATORS, MAX_NUMBER_OF_EVALUATORS)
        .build();
    return launch(runtimeConf, vortexConf.getConfiguration());
  }
533675
def entrypoint_script(*lines):
    ''
    lines = list(lines)
    if lines and not lines[0].startswith('#!'):
        lines.insert(0, '#!/bin/sh')
    return eval([['entrypoint', '/entrypoint'],
                 ['write-script', '/entrypoint'] + lines])
355393
def main():
    """"""
    log = logging.getLogger('sip.mock_workflow_stage')

    if len(sys.argv) != 2:
        log.critical('Expecting JSON string as first argument!')
        return

    config = json.loads(sys.argv[1])
    log.info('Running mock_workflow_stage (version: %s).', __version__)
    log.info('Received configuration: %s', json.dumps(config))
    log.info('Starting task')

    i = 0
    start_time = time.time()
    duration = config.get('duration', 20)
    while time.time() - start_time <= duration:
        time.sleep(duration / 20)
        elapsed = time.time() - start_time
        log.info("  %s %2i / 20 (elapsed %.2f s)",
                 config.get('message', 'Progress '),
                 i + 1, elapsed)
        i += 1

    log.info('Task complete!')
651322
function() {
            YAHOO.log('Creating Shim Element', 'info', 'DragDropMgr');
            var s = document.createElement('div');
            s.id = 'yui-ddm-shim';
            if (document.body.firstChild) {
                document.body.insertBefore(s, document.body.firstChild);
            } else {
                document.body.appendChild(s);
            }
            s.style.display = 'none';
            s.style.backgroundColor = 'red';
            s.style.position = 'absolute';
            s.style.zIndex = '99999';
            Dom.setStyle(s, 'opacity', '0');
            this._shim = s;
            Event.on(s, "mouseup",   this.handleMouseUp, this, true);
            Event.on(s, "mousemove", this.handleMouseMove, this, true);
            Event.on(window, 'scroll', this._sizeShim, this, true);
        }
558929
protected function starting() : void
    {
        $this->agg = (new Aggregator($this))->start();
        $this->out = (new Prometheus($this->host, $this->app, $this->agg))->start($this->listener, $this->gateway);
        $this->cls = (new Cleaner($this))->start();
    }
344666
def main():
    """"""

    # test example below taken from GMMRA by Azari, Chen, Parkes, & Xia
    cand_set = [0, 1, 2]
    votes = [[0, 1, 2], [1, 2, 0]]

    mmagg = MMPLAggregator(cand_set)
    gamma = mmagg.aggregate(votes, epsilon=1e-7, max_iters=20)
    print(mmagg.alts_to_ranks, mmagg.ranks_to_alts)
    assert([mmagg.get_ranking(i) for i in cand_set] == [1,0,2])
    print(gamma)
1279720
def _WorkerCommand_launcher(self):
        """"""
        return [
            self.workersArguments.pythonExecutable,
            '-m',
            'scoop.launch.__main__',
            str(self.workerAmount),
            str(self.workersArguments.verbose),
        ]