当前位置: 首页>>代码示例>>Python>>正文


Python NailgunTask.killall方法代码示例

本文整理汇总了Python中twitter.pants.tasks.nailgun_task.NailgunTask.killall方法的典型用法代码示例。如果您正苦于以下问题:Python NailgunTask.killall方法的具体用法?Python NailgunTask.killall怎么用?Python NailgunTask.killall使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在twitter.pants.tasks.nailgun_task.NailgunTask的用法示例。


在下文中一共展示了NailgunTask.killall方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _run

# 需要导入模块: from twitter.pants.tasks.nailgun_task import NailgunTask [as 别名]
# 或者: from twitter.pants.tasks.nailgun_task.NailgunTask import killall [as 别名]
def _run():
  version = get_version()
  if len(sys.argv) == 2 and sys.argv[1] == _VERSION_OPTION:
    _do_exit(version)

  root_dir = get_buildroot()
  if not os.path.exists(root_dir):
    _exit_and_fail('PANTS_BUILD_ROOT does not point to a valid path: %s' % root_dir)

  if len(sys.argv) < 2 or (len(sys.argv) == 2 and sys.argv[1] in _HELP_ALIASES):
    _help(version, root_dir)

  command_class, command_args = _parse_command(root_dir, sys.argv[1:])

  parser = optparse.OptionParser(version=version)
  RcFile.install_disable_rc_option(parser)
  parser.add_option(_LOG_EXIT_OPTION,
                    action='store_true',
                    default=False,
                    dest='log_exit',
                    help = 'Log an exit message on success or failure.')

  config = Config.load()
  run_tracker = RunTracker(config)
  report = initial_reporting(config, run_tracker)
  run_tracker.start(report)

  url = run_tracker.run_info.get_info('report_url')
  if url:
    run_tracker.log(Report.INFO, 'See a report at: %s' % url)
  else:
    run_tracker.log(Report.INFO, '(To run a reporting server: ./pants server)')

  command = command_class(run_tracker, root_dir, parser, command_args)
  try:
    if command.serialized():
      def onwait(pid):
        print('Waiting on pants process %s to complete' % _process_info(pid), file=sys.stderr)
        return True
      runfile = os.path.join(root_dir, '.pants.run')
      lock = Lock.acquire(runfile, onwait=onwait)
    else:
      lock = Lock.unlocked()
    try:
      result = command.run(lock)
      _do_exit(result)
    except KeyboardInterrupt:
      command.cleanup()
      raise
    finally:
      lock.release()
  finally:
    run_tracker.end()
    # Must kill nailguns only after run_tracker.end() is called, because there may still
    # be pending background work that needs a nailgun.
    if (hasattr(command.options, 'cleanup_nailguns') and command.options.cleanup_nailguns) \
        or config.get('nailgun', 'autokill', default=False):
      NailgunTask.killall(None)
开发者ID:alfss,项目名称:commons,代码行数:60,代码来源:pants_exe.py

示例2: run

# 需要导入模块: from twitter.pants.tasks.nailgun_task import NailgunTask [as 别名]
# 或者: from twitter.pants.tasks.nailgun_task.NailgunTask import killall [as 别名]
  def run(self, lock):
    # Update the reporting settings, now that we have flags etc.
    def is_console_task():
      for phase in self.phases:
        for goal in phase.goals():
          if issubclass(goal.task_type, ConsoleTask):
            return True
      return False

    update_reporting(self.options, is_console_task(), self.run_tracker)

    if self.options.dry_run:
      print '****** Dry Run ******'

    context = Context(
      self.config,
      self.options,
      self.run_tracker,
      self.targets,
      requested_goals=self.requested_goals,
      lock=lock)

    # TODO: Time to get rid of this hack.
    if self.options.recursive_directory:
      context.log.warn(
        '--all-recursive is deprecated, use a target spec with the form [dir]:: instead')
      for dir in self.options.recursive_directory:
        self.add_target_recursive(dir)

    if self.options.target_directory:
      context.log.warn('--all is deprecated, use a target spec with the form [dir]: instead')
      for dir in self.options.target_directory:
        self.add_target_directory(dir)

    unknown = []
    for phase in self.phases:
      if not phase.goals():
        unknown.append(phase)

    if unknown:
      print('Unknown goal(s): %s' % ' '.join(phase.name for phase in unknown))
      print('')
      return Phase.execute(context, 'goals')

    ret = Phase.attempt(context, self.phases)

    if self.options.cleanup_nailguns or self.config.get('nailgun', 'autokill', default = False):
      if log:
        log.debug('auto-killing nailguns')
      if NailgunTask.killall:
        NailgunTask.killall(log)

    return ret
开发者ID:jalons,项目名称:commons,代码行数:55,代码来源:goal.py

示例3: execute

# 需要导入模块: from twitter.pants.tasks.nailgun_task import NailgunTask [as 别名]
# 或者: from twitter.pants.tasks.nailgun_task.NailgunTask import killall [as 别名]
 def execute(self, targets):
   if NailgunTask.killall:
     NailgunTask.killall(self.context.log, everywhere=self.context.options.ng_killall_evywhere)
开发者ID:soheilhy,项目名称:commons,代码行数:5,代码来源:goal.py

示例4: _run

# 需要导入模块: from twitter.pants.tasks.nailgun_task import NailgunTask [as 别名]
# 或者: from twitter.pants.tasks.nailgun_task.NailgunTask import killall [as 别名]
def _run():
  """
  To add additional paths to sys.path, add a block to the config similar to the following:
  [main]
  roots: ['src/python/twitter/pants_internal/test/',]
  """
  version = get_version()
  if len(sys.argv) == 2 and sys.argv[1] == _VERSION_OPTION:
    _do_exit(version)

  root_dir = get_buildroot()
  if not os.path.exists(root_dir):
    _exit_and_fail('PANTS_BUILD_ROOT does not point to a valid path: %s' % root_dir)

  if len(sys.argv) < 2 or (len(sys.argv) == 2 and sys.argv[1] in _HELP_ALIASES):
    _help(version, root_dir)

  command_class, command_args = _parse_command(root_dir, sys.argv[1:])

  parser = optparse.OptionParser(version=version)
  RcFile.install_disable_rc_option(parser)
  parser.add_option(_LOG_EXIT_OPTION,
                    action='store_true',
                    default=False,
                    dest='log_exit',
                    help = 'Log an exit message on success or failure.')

  config = Config.load()

  # TODO: This can be replaced once extensions are enabled with
  # https://github.com/pantsbuild/pants/issues/5
  roots = config.getlist('parse', 'roots', default=[])
  sys.path.extend(map(lambda root: os.path.join(root_dir, root), roots))

  # XXX(wickman) This should be in the command goal, not un pants_exe.py!
  run_tracker = RunTracker.from_config(config)
  report = initial_reporting(config, run_tracker)
  run_tracker.start(report)

  url = run_tracker.run_info.get_info('report_url')
  if url:
    run_tracker.log(Report.INFO, 'See a report at: %s' % url)
  else:
    run_tracker.log(Report.INFO, '(To run a reporting server: ./pants server)')

  command = command_class(run_tracker, root_dir, parser, command_args)
  try:
    if command.serialized():
      def onwait(pid):
        print('Waiting on pants process %s to complete' % _process_info(pid), file=sys.stderr)
        return True
      runfile = os.path.join(root_dir, '.pants.run')
      lock = Lock.acquire(runfile, onwait=onwait)
    else:
      lock = Lock.unlocked()
    try:
      result = command.run(lock)
      _do_exit(result)
    except KeyboardInterrupt:
      command.cleanup()
      raise
    finally:
      lock.release()
  finally:
    run_tracker.end()
    # Must kill nailguns only after run_tracker.end() is called, because there may still
    # be pending background work that needs a nailgun.
    if (hasattr(command.options, 'cleanup_nailguns') and command.options.cleanup_nailguns) \
        or config.get('nailgun', 'autokill', default=False):
      NailgunTask.killall(None)
开发者ID:FernandoG26,项目名称:commons,代码行数:72,代码来源:pants_exe.py

示例5: execute

# 需要导入模块: from twitter.pants.tasks.nailgun_task import NailgunTask [as 别名]
# 或者: from twitter.pants.tasks.nailgun_task.NailgunTask import killall [as 别名]
 def execute(self, targets):
   if NailgunTask.killall:
     NailgunTask.killall(self.context.log, everywhere=self.context.options.ng_killall_everywhere)
   else:
     raise NotImplementedError, 'NailgunKillall not implemented on this platform'
开发者ID:alaattinturyan,项目名称:commons,代码行数:7,代码来源:goal.py

示例6: cleanup

# 需要导入模块: from twitter.pants.tasks.nailgun_task import NailgunTask [as 别名]
# 或者: from twitter.pants.tasks.nailgun_task.NailgunTask import killall [as 别名]
 def cleanup(self):
   # TODO: Make this more selective? Only kill nailguns that affect state? E.g., checkstyle
   # may not need to be killed.
   if NailgunTask.killall:
     NailgunTask.killall(log)
   sys.exit(1)
开发者ID:alaattinturyan,项目名称:commons,代码行数:8,代码来源:goal.py

示例7: run

# 需要导入模块: from twitter.pants.tasks.nailgun_task import NailgunTask [as 别名]
# 或者: from twitter.pants.tasks.nailgun_task.NailgunTask import killall [as 别名]
  def run(self, lock):
    if self.options.dry_run:
      print('****** Dry Run ******')

    logger = None
    if self.options.log or self.options.log_level:
      log.LogOptions.set_stderr_log_level((self.options.log_level or 'info').upper())
      logdir = self.options.logdir or self.config.get('goals', 'logdir', default=None)
      if logdir:
        safe_mkdir(logdir)
        log.LogOptions.set_log_dir(logdir)
        log.init('goals')
      else:
        log.init()
      logger = log

      if not self.options.no_color:
        def colorwrapper(func, clrname):
          @wraps(func)
          def wrapper(msg, *args, **kwargs):
            return func(clrname(msg), *args, **kwargs)
          return wrapper

        log.info = colorwrapper(log.info, green)
        log.warn = colorwrapper(log.warn, yellow)
        log.debug = colorwrapper(log.debug, cyan)

    if self.options.recursive_directory:
      log.warn('--all-recursive is deprecated, use a target spec with the form [dir]:: instead')
      for dir in self.options.recursive_directory:
        self.add_target_recursive(dir)

    if self.options.target_directory:
      log.warn('--all is deprecated, use a target spec with the form [dir]: instead')
      for dir in self.options.target_directory:
        self.add_target_directory(dir)

    context = Context(
      self.config,
      self.options,
      self.targets,
      requested_goals=self.requested_goals,
      lock=lock,
      log=logger,
      timer=self.timer if self.options.time else None)

    unknown = []
    for phase in self.phases:
      if not phase.goals():
        unknown.append(phase)

    if unknown:
      print('Unknown goal(s): %s' % ' '.join(phase.name for phase in unknown))
      print('')
      return Phase.execute(context, 'goals')

    if logger:
      logger.debug('Operating on targets: %s' % self.targets)

    ret = Phase.attempt(context, self.phases)

    if self.options.cleanup_nailguns or self.config.get('nailgun', 'autokill', default = False):
      if log:
        log.debug('auto-killing nailguns')
      if NailgunTask.killall:
        NailgunTask.killall(log)

    if self.options.time:
      print('Timing report')
      print('=============')
      self.timer.print_timings()

    return ret
开发者ID:steliokontos,项目名称:commons,代码行数:75,代码来源:goal.py

示例8: run

# 需要导入模块: from twitter.pants.tasks.nailgun_task import NailgunTask [as 别名]
# 或者: from twitter.pants.tasks.nailgun_task.NailgunTask import killall [as 别名]
  def run(self, lock):
    # Update the reporting settings, now that we have flags etc.

    log_level = Report.log_level_from_string(self.options.log_level or 'info')
    color = not self.options.no_color
    timing = self.options.time
    cache_stats = self.options.time  # TODO: Separate flag for this?

    settings_updates_map = {
      'console': {
        'log_level': log_level, 'color': color, 'timing': timing, 'cache_stats': cache_stats
      },
      'html': {
        'log_level': log_level
      }
    }
    self.run_tracker.update_report_settings(settings_updates_map)
    # TODO: Do something useful with --logdir.

    if self.options.dry_run:
      print '****** Dry Run ******'

    context = Context(
      self.config,
      self.options,
      self.run_tracker,
      self.targets,
      requested_goals=self.requested_goals,
      lock=lock)

    # TODO: Time to get rid of this hack.
    if self.options.recursive_directory:
      context.log.warn(
        '--all-recursive is deprecated, use a target spec with the form [dir]:: instead')
      for dir in self.options.recursive_directory:
        self.add_target_recursive(dir)

    if self.options.target_directory:
      context.log.warn('--all is deprecated, use a target spec with the form [dir]: instead')
      for dir in self.options.target_directory:
        self.add_target_directory(dir)

    unknown = []
    for phase in self.phases:
      if not phase.goals():
        unknown.append(phase)

    if unknown:
      print('Unknown goal(s): %s' % ' '.join(phase.name for phase in unknown))
      print('')
      return Phase.execute(context, 'goals')

    ret = Phase.attempt(context, self.phases)

    if self.options.cleanup_nailguns or self.config.get('nailgun', 'autokill', default = False):
      if log:
        log.debug('auto-killing nailguns')
      if NailgunTask.killall:
        NailgunTask.killall(log)

    return ret
开发者ID:wickman,项目名称:commons,代码行数:63,代码来源:goal.py


注:本文中的twitter.pants.tasks.nailgun_task.NailgunTask.killall方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。