Disbatch runner client_async commands
975101
def _disbatch_runner_async(self, chunk):
        '''
        
        '''
        pub_data = self.saltclients['runner'](chunk)
        raise tornado.gen.Return(pub_data)
538794
async def disable(self, ctx, *, command: str):
        
        command = command.lower()

        if command in ('enable', 'disable'):
            return await self.bot.responses.failure(message='Cannot disable that command.')

        if command not in self.bot.commands:
            return await self.bot.responses.failure(message='Command "{}" was not found.'.format(command))

        guild_id = ctx.message.server.id
        cmds = self.config.get('commands', {})
        entries = cmds.get(guild_id, [])
        entries.append(command)
        cmds[guild_id] = entries
        await self.config.put('commands', cmds)
        await self.bot.responses.success(message='"%s" command disabled in this server.' % command)
1006595
void doNotifyIfNecessary() {
        if (status.compareAndSet(ConnectionStatus.RUNNING, ConnectionStatus.RELEASE) || status.compareAndSet(ConnectionStatus.TERMINATED, ConnectionStatus.RELEASE)) {
            resourceSynchronizer.doNotify();
        }
    }
779649
def command_line_runner():
    """"""
    parser = get_parser()
    args = vars(parser.parse_args())
    if args['version']:
        print(__version__)
        return
    if args['clear_cache']:
        utils.clear_cache()
        print('Cleared {0}.'.format(utils.CACHE_DIR))
        return
    if not args['query']:
        parser.print_help()
        return

    # Enable cache unless user sets environ variable SCRAPE_DISABLE_CACHE
    if not os.getenv('SCRAPE_DISABLE_CACHE'):
        utils.enable_cache()

    # Save images unless user sets environ variable SCRAPE_DISABLE_IMGS
    if os.getenv('SCRAPE_DISABLE_IMGS'):
        args['no_images'] = True

    # Prompt user for filetype if none specified
    prompt_filetype(args)

    # Prompt user to save images when crawling (for pdf and HTML formats)
    prompt_save_images(args)

    # Scrape webpage content
    scrape(args)
872926
function cleanup (exitCode) {
  if(_disabled) {
    return q.resolve();
  }

  var defer = q.defer();

  _readRunIdFile().then(function (run) {
    _logMessage('test finished. Your results can be viewed at: ' +
      'http://' + _hostname + ':' + _port + '/#/' + run.project_id + '/' + run.suite_id + '/' + run.run_id + '/rp');
    fs.unlink(RUN_PID_FILE, function (err) {
      if (err) {
        defer.reject(err);
      } else {
        defer.resolve();
      }
    });
  });

  return defer.promise;
}
946074
function killRunningProcess(procName, callback) {
  var pidFilePath = pidDir + procName + '.pid';
  fs.readFile(pidFilePath, function(err, pidData) {
    if (err) {
      return callback(err);
    } else {
      return exec('kill ' + pidData.toString(), function(err, stdout, stderr) {
	return callback(null);
      });
    }
  });
}
83091
def exit_resync(self):
        """"""
        print("********** exit & resync **********")
        try:
            if self.client_socket:
                self.client_socket.close()
                self.client_socket = None
            try:
                self.exit()
            except Exception as e:
                self._log_error(e)
            print("Pause for exit(s) ...")
            time.sleep(60)
        except (socket.error, ConnectionError):
            pass
        self.resync()
197138
def halt_running():
    ''''''
    vultr = Vultr(API_KEY)

    try:
            serverList = vultr.server.list()
            #logging.info('Listing servers:\n%s', dumps(
            #serverList, indent=2
        #))
    except VultrError as ex:
        logging.error('VultrError: %s', ex)

    for serverID in serverList:
        if serverList[serverID]['power_status'] == 'running':
            logging.info(serverList[serverID]['label'] + " will be gracefully shutdown.")
            vultr.server.halt(serverID)
1374322
def runner(self, classpath, main, jvm_options=None, args=None, cwd=None):
    """"""
    return self._runner(*self._scrub_args(classpath, main, jvm_options, args, cwd=cwd))
267010
def run(entry_point, drivers, loop = None):
    ''' 
    '''
    program = setup(entry_point, drivers)
    dispose = program.run()
    if loop == None:
        loop = asyncio.get_event_loop()

    loop.run_forever()
    dispose()
829958
def runRemoteCommand(self, cmd, args, abandonOnFailure=True,
                         evaluateCommand=lambda cmd: cmd.didFail()):
        """"""
        cmd = remotecommand.RemoteCommand(cmd, args)
        if hasattr(self, "rc_log"):
            cmd.useLog(self.rc_log, False)
        d = self.runCommand(cmd)

        def commandComplete(cmd):
            if abandonOnFailure and cmd.didFail():
                raise buildstep.BuildStepFailed()
            return evaluateCommand(cmd)

        d.addCallback(lambda res: commandComplete(cmd))
        return d
708164
def _disbatch_local_async(self, chunk):
        '''
        
        '''
        f_call = self._format_call_run_job_async(chunk)
        # fire a job off
        pub_data = yield self.saltclients['local_async'](*f_call.get('args', ()), **f_call.get('kwargs', {}))

        raise tornado.gen.Return(pub_data)
1273466
function asyncWrapper(promise){
    return function(...args){
        // extract options (last argument)
        _optionsManager.parse(args.pop())

            // trigger command
            .then(options => {
                // re-merge
                return promise(...args, options)
            })

            // trigger disconnect
            .then(() => {
                if (_nodemcutool.Connector.isConnected()){
                    _logger.log('disconnecting');
                    return _nodemcutool.disconnect();
                }
            })

            // gracefull exit
            
            .then(() => {
                process.exit(0)
            })

            // handle low-level errors
            .catch(err => {
                _logger.error(err.message);
                _logger.debug(err.stack);
                process.exit(1);
            });
    }
}
566701
function createRunnerMiddleware (emitter, fileList, capturedBrowsers, reporter, executor,
  /* config.protocol */ protocol, /* config.hostname */ hostname, /* config.port */
  port, /* config.urlRoot */ urlRoot, config) {
  helper.saveOriginalArgs(config)
  return function (request, response, next) {
    if (request.url !== '/__run__' && request.url !== urlRoot + 'run') {
      return next()
    }

    log.debug('Execution (fired by runner)')
    response.writeHead(200)

    if (!capturedBrowsers.length) {
      const url = `${protocol}//${hostname}:${port}${urlRoot}`
      return response.end(`No captured browser, open ${url}\n`)
    }

    json(request, response, function () {
      if (!capturedBrowsers.areAllReady([])) {
        response.write('Waiting for previous execution...\n')
      }

      const data = request.body
      emitter.once('run_start', function () {
        const responseWrite = response.write.bind(response)
        responseWrite.colors = data.colors
        reporter.addAdapter(responseWrite)

        // clean up, close runner response
        emitter.once('run_complete', function (browsers, results) {
          reporter.removeAdapter(responseWrite)
          const emptyTestSuite = (results.failed + results.success) === 0 ? 0 : 1
          response.end(constant.EXIT_CODE + emptyTestSuite + results.exitCode)
        })
      })

      helper.restoreOriginalArgs(config)
      if (_.isEmpty(data.args)) {
        log.debug('Ignoring empty client.args from run command')
      } else if ((_.isArray(data.args) && _.isArray(config.client.args)) ||
        (_.isPlainObject(data.args) && _.isPlainObject(config.client.args))) {
        log.debug('Merging client.args with ', data.args)
        config.client.args = _.merge(config.client.args, data.args)
      } else {
        log.warn('Replacing client.args with ', data.args, ' as their types do not match.')
        config.client.args = data.args
      }

      let fullRefresh = true

      if (helper.isArray(data.changedFiles)) {
        data.changedFiles.forEach(function (filepath) {
          fileList.changeFile(path.resolve(config.basePath, filepath))
          fullRefresh = false
        })
      }

      if (helper.isArray(data.addedFiles)) {
        data.addedFiles.forEach(function (filepath) {
          fileList.addFile(path.resolve(config.basePath, filepath))
          fullRefresh = false
        })
      }

      if (helper.isArray(data.removedFiles)) {
        data.removedFiles.forEach(function (filepath) {
          fileList.removeFile(path.resolve(config.basePath, filepath))
          fullRefresh = false
        })
      }

      if (fullRefresh && data.refresh !== false) {
        log.debug('Refreshing all the files / patterns')
        fileList.refresh().then(function () {
          // Wait for the file list refresh to complete before starting test run,
          // otherwise the context.html generation might not see new/updated files.
          if (!config.autoWatch) {
            executor.schedule()
          }
        })
      } else {
        executor.schedule()
      }
    })
  }
}
1086586
def rm_command(
    ignore_missing,
    star_silent,
    recursive,
    enable_globs,
    endpoint_plus_path,
    label,
    submission_id,
    dry_run,
    deadline,
    skip_activation_check,
    notify,
    meow,
    heartbeat,
    polling_interval,
    timeout,
    timeout_exit_code,
):
    
    endpoint_id, path = endpoint_plus_path

    client = get_client()

    # attempt to activate unless --skip-activation-check is given
    if not skip_activation_check:
        autoactivate(client, endpoint_id, if_expires_in=60)

    delete_data = DeleteData(
        client,
        endpoint_id,
        label=label,
        recursive=recursive,
        ignore_missing=ignore_missing,
        submission_id=submission_id,
        deadline=deadline,
        skip_activation_check=skip_activation_check,
        interpret_globs=enable_globs,
        **notify
    )

    if not star_silent and enable_globs and path.endswith("*"):
        # not intuitive, but `click.confirm(abort=True)` prints to stdout
        # unnecessarily, which we don't really want...
        # only do this check if stderr is a pty
        if (
            err_is_terminal()
            and term_is_interactive()
            and not click.confirm(
                'Are you sure you want to delete all files matching "{}"?'.format(path),
                err=True,
            )
        ):
            safeprint("Aborted.", write_to_stderr=True)
            click.get_current_context().exit(1)
    delete_data.add_item(path)

    if dry_run:
        formatted_print(delete_data, response_key="DATA", fields=[("Path", "path")])
        # exit safely
        return

    # Print task submission to stderr so that `-Fjson` is still correctly
    # respected, as it will be by `task wait`
    res = client.submit_delete(delete_data)
    task_id = res["task_id"]
    safeprint(
        'Delete task submitted under ID "{}"'.format(task_id), write_to_stderr=True
    )

    # do a `task wait` equivalent, including printing and correct exit status
    task_wait_with_io(
        meow,
        heartbeat,
        polling_interval,
        timeout,
        task_id,
        timeout_exit_code,
        client=client,
    )
1110436
def flush(flush = Zlib::SYNC_FLUSH)
      run '', flush unless flush == Zlib::NO_FLUSH

      detatch_output
    end
380290
function run(params, command, callback)
{
  var terminator
    , requiresContext = isArrowFunction(command)
    ;

  // make sure callback is invoked in real async way
  callback = async(callback);

  // check provided function if it expected
  // to be run in async or sync way

  // expects no arguments, run it as sync function
  // unless it's function straight outta factory
  // has `.commandDescription` property
  //
  // Or it has one argument and requires context
  // must be arrow function with `context` argument
  if ((command.length === 0 || (command.length === 1 && requiresContext)) && !command.commandDescription)
  {
    runSync(this, command, callback);
  }
  else // or run it as async
  {
    // async function may return terminator function
    terminator = runAsync(this, command, callback);
  }

  // return provided terminator or empty function
  // if there is none
  return terminator || function() {};
}