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


Python Task.__init__方法代码示例

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


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

示例1: __init__

# 需要导入模块: from twitter.pants.tasks import Task [as 别名]
# 或者: from twitter.pants.tasks.Task import __init__ [as 别名]
    def __init__(
        self,
        context,
        classpath=None,
        workdir=None,
        nailgun_jar=None,
        args=None,
        stdin=None,
        stderr=sys.stderr,
        stdout=sys.stdout,
    ):
        Task.__init__(self, context)

        self._classpath = classpath
        self._nailgun_jar = nailgun_jar or context.config.get("nailgun", "jar")
        self._ng_server_args = args or context.config.getlist("nailgun", "args")
        self._stdin = stdin
        self._stderr = stderr
        self._stdout = stdout
        self._daemon = context.options.nailgun_daemon

        workdir = workdir or context.config.get("nailgun", "workdir")
        self._pidfile = os.path.join(workdir, "pid")
        self._ng_out = os.path.join(workdir, "stdout")
        self._ng_err = os.path.join(workdir, "stderr")
开发者ID:ewhauser,项目名称:commons,代码行数:27,代码来源:nailgun_task.py

示例2: __init__

# 需要导入模块: from twitter.pants.tasks import Task [as 别名]
# 或者: from twitter.pants.tasks.Task import __init__ [as 别名]
  def __init__(self, context, output_dir=None, confs=None):
    Task.__init__(self, context)

    self._output_dir = (
      output_dir
      or context.options.jar_create_outdir
      or context.config.get('jar-create', 'workdir')
    )
    self.transitive = context.options.jar_create_transitive
    self.confs = confs or context.config.getlist('jar-create', 'confs')
    self.compression = ZIP_DEFLATED if context.options.jar_create_compressed else ZIP_STORED

    self.jar_classes = context.options.jar_create_classes or context.products.isrequired('jars')
    if self.jar_classes:
      self.context.products.require('classes')

    self.jar_sources = (
      context.options.jar_create_sources
      or context.products.isrequired('source_jars')
    )

    self.jar_javadoc = (
      context.options.jar_create_javadoc
      or context.products.isrequired('javadoc_jars')
    )
    if self.jar_javadoc:
      context.products.require('javadoc')
开发者ID:billwei,项目名称:commons,代码行数:29,代码来源:jar_create.py

示例3: __init__

# 需要导入模块: from twitter.pants.tasks import Task [as 别名]
# 或者: from twitter.pants.tasks.Task import __init__ [as 别名]
  def __init__(self, context):
    Task.__init__(self, context)

    options = context.options
    products = context.products

    self._output_dir = options.jar_create_outdir or context.config.get('jar-create', 'workdir')
    self.transitive = options.jar_create_transitive
    self.confs = context.config.getlist('jar-create', 'confs')
    self.compression = ZIP_DEFLATED if options.jar_create_compressed else ZIP_STORED

    self.jar_classes = products.isrequired('jars') or options.jar_create_classes
    if self.jar_classes:
      products.require_data('classes_by_target')
      products.require_data('resources_by_target')

    self.jar_idl = products.isrequired('idl_jars') or options.jar_create_idl
    if self.jar_idl:
      products.require('idl')

    self.jar_javadoc = products.isrequired('javadoc_jars') or options.jar_create_javadoc
    if self.jar_javadoc:
      products.require('javadoc')

    self.jar_sources = products.isrequired('source_jars') or options.jar_create_sources

    self._jars = {}
开发者ID:alfss,项目名称:commons,代码行数:29,代码来源:jar_create.py

示例4: __init__

# 需要导入模块: from twitter.pants.tasks import Task [as 别名]
# 或者: from twitter.pants.tasks.Task import __init__ [as 别名]
  def __init__(self, context):
    Task.__init__(self, context)
    config = context.config
    self.confs = config.getlist('benchmark-run', 'confs')
    self.jvm_options = config.getlist('benchmark-run', 'args',
                                      default=['-Xmx1g', '-XX:MaxPermSize=256m'])

    self._benchmark_bootstrap_key = 'benchmark-tool'
    benchmark_bootstrap_tools = config.getlist('benchmark-run', 'bootstrap-tools',
                                               default=[':benchmark-caliper-0.5'])
    self._jvm_tool_bootstrapper.register_jvm_tool(self._benchmark_bootstrap_key, benchmark_bootstrap_tools)
    self._agent_bootstrap_key = 'benchmark-agent'
    agent_bootstrap_tools = config.getlist('benchmark-run', 'agent_profile',
                                           default=[':benchmark-java-allocation-instrumenter-2.1'])
    self._jvm_tool_bootstrapper.register_jvm_tool(self._agent_bootstrap_key, agent_bootstrap_tools)

    # TODO(Steve Gury):
    # Find all the target classes from the Benchmark target itself
    # https://jira.twitter.biz/browse/AWESOME-1938
    self.caliper_args = context.options.target_class

    if context.options.memory_profiling:
      self.caliper_args += ['--measureMemory']

    if context.options.debug:
      self.jvm_options.extend(context.config.getlist('jvm', 'debug_args'))
      self.caliper_args += ['--debug']
开发者ID:alfss,项目名称:commons,代码行数:29,代码来源:benchmark_run.py

示例5: __init__

# 需要导入模块: from twitter.pants.tasks import Task [as 别名]
# 或者: from twitter.pants.tasks.Task import __init__ [as 别名]
  def __init__(self, context, classpath=None, workdir=None):
    Task.__init__(self, context)

    self._classpath = classpath
    self._nailgun_bootstrap_key = 'nailgun'
    nailgun_bootstrap_tools = context.config.getlist('nailgun', 'bootstrap-tools',
                                                     default=[':nailgun-server'])

    self._bootstrap_utils.register_jvm_build_tools(self._nailgun_bootstrap_key, nailgun_bootstrap_tools)

    self._ng_server_args = context.config.getlist('nailgun', 'args')
    self._daemon = context.options.nailgun_daemon

    workdir = workdir or context.config.get('nailgun', 'workdir')

    # Allows us to identify the nailgun process by its cmd-line.
    self._identifier_arg = '-Dpants.ng.identifier=%s' % os.path.relpath(workdir, get_buildroot())

    self._current_pidport = None

    self._ng_out = os.path.join(workdir, 'stdout')
    self._ng_err = os.path.join(workdir, 'stderr')

    # Prevent concurrency issues when starting up a nailgun.
    self._spawn_lock = threading.Lock()
开发者ID:bollwang,项目名称:commons,代码行数:27,代码来源:nailgun_task.py

示例6: __init__

# 需要导入模块: from twitter.pants.tasks import Task [as 别名]
# 或者: from twitter.pants.tasks.Task import __init__ [as 别名]
  def __init__(self, context):
    Task.__init__(self, context)
    self.profile = context.config.get('benchmark-run', 'profile',
                                      default="benchmark-caliper-0.5")
    self.confs = context.config.getlist('benchmark-run', 'confs')
    self.java_args = context.config.getlist('benchmark-run', 'args',
                                            default=['-Xmx1g', '-XX:MaxPermSize=256m'])
    self.agent_profile = context.config.get('benchmark-run', 'agent_profile',
                                            default="benchmark-java-allocation-instrumenter-2.1")
    # TODO(Steve Gury):
    # Find all the target classes from the Benchmark target itself
    # https://jira.twitter.biz/browse/AWESOME-1938
    self.caliper_args = context.options.target_class

    if context.options.memory_profiling:
      self.caliper_args += ['--measureMemory']
      # For rewriting JDK classes to work, the JAR file has to be listed specifically in
      # the JAR manifest as something that goes in the bootclasspath.
      # The MANIFEST list a jar 'allocation.jar' this is why we have to rename it
      agent_jar = os.readlink(profile_classpath(self.agent_profile)[0])
      allocation_jar = os.path.join(os.path.dirname(agent_jar), "allocation.jar")
      # TODO(Steve Gury): Find a solution to avoid copying the jar every run and being resilient
      # to version upgrade
      shutil.copyfile(agent_jar, allocation_jar)
      os.environ['ALLOCATION_JAR'] = str(allocation_jar)

    if context.options.debug:
      self.java_args.extend(context.config.getlist('jvm', 'debug_args'))
      self.caliper_args += ['--debug']
开发者ID:BabyDuncan,项目名称:commons,代码行数:31,代码来源:benchmark_run.py

示例7: __init__

# 需要导入模块: from twitter.pants.tasks import Task [as 别名]
# 或者: from twitter.pants.tasks.Task import __init__ [as 别名]
  def __init__(self, context):
    Task.__init__(self, context)

    self.confs = context.config.getlist('junit-run', 'confs')
    self.profile = context.config.get('junit-run', 'profile')

    self.java_args = context.config.getlist('junit-run', 'args', default=[])
    if context.options.junit_run_jvmargs:
      self.java_args.extend(context.options.junit_run_jvmargs)
    if context.options.junit_run_debug:
      self.java_args.extend(context.config.getlist('jvm', 'debug_args'))

    self.test_classes = context.options.junit_run_tests
    self.context.products.require('classes')

    self.outdir = (
      context.options.junit_run_outdir
      or context.config.get('junit-run', 'workdir')
    )

    self.flags = []
    if context.options.junit_run_xmlreport or context.options.junit_run_suppress_output:
      if context.options.junit_run_xmlreport:
        self.flags.append('-xmlreport')
      self.flags.append('-suppress-output')
      self.flags.append('-outdir')
      self.flags.append(self.outdir)
开发者ID:adamsxu,项目名称:commons,代码行数:29,代码来源:junit_run.py

示例8: __init__

# 需要导入模块: from twitter.pants.tasks import Task [as 别名]
# 或者: from twitter.pants.tasks.Task import __init__ [as 别名]
  def __init__(self, context, output_dir=None, version=None, java_geninfo=None, python_geninfo=None,
               strict=None, verbose=None):

    Task.__init__(self, context)

    self.thrift_binary = select_binary(
      context.config.get('thrift-gen', 'supportdir'),
      version or context.config.get('thrift-gen', 'version'),
      'thrift'
    )
    self.output_dir = (
      output_dir
      or context.options.thrift_gen_create_outdir
      or context.config.get('thrift-gen', 'workdir')
    )
    self.strict = strict or context.config.getbool('thrift-gen', 'strict')
    self.verbose = verbose or context.config.getbool('thrift-gen', 'verbose')

    def create_geninfo(key):
      gen_info = context.config.getdict('thrift-gen', key)
      gen = gen_info['gen']
      deps = OrderedSet()
      for dep in gen_info['deps']:
        deps.update(context.resolve(dep))
      return ThriftGen.GenInfo(gen, deps)

    self.gen_java = java_geninfo or create_geninfo('java')
    self.gen_python = python_geninfo or create_geninfo('python')
    self.gen_langs = set(context.options.thrift_gen_langs)
开发者ID:billwei,项目名称:commons,代码行数:31,代码来源:thrift_gen.py

示例9: __init__

# 需要导入模块: from twitter.pants.tasks import Task [as 别名]
# 或者: from twitter.pants.tasks.Task import __init__ [as 别名]
  def __init__(self, context):
    Task.__init__(self, context)

    self.confs = context.config.getlist('junit-run', 'confs')
    self.junit_profile = context.config.get('junit-run', 'junit_profile')
    self.emma_profile = context.config.get('junit-run', 'emma_profile')

    self.junit_runner = (
      context.options.junit_runner
      or context.config.get('junit-run', 'runner',
                            default='com.twitter.common.testing.runner.JUnitConsoleRunner')
    )

    self.java_args = context.config.getlist('junit-run', 'args', default=[])
    if context.options.junit_run_jvmargs:
      self.java_args.extend(context.options.junit_run_jvmargs)
    if context.options.junit_run_debug:
      self.java_args.extend(context.config.getlist('jvm', 'debug_args'))

    self.test_classes = context.options.junit_run_tests
    self.context.products.require('classes')

    self.outdir = (
      context.options.junit_run_outdir
      or context.config.get('junit-run', 'workdir')
    )

    self.coverage = context.options.junit_run_coverage
    self.coverage_filters = context.options.junit_run_coverage_patterns or []
    self.coverage_dir = os.path.join(self.outdir, 'coverage')
    self.coverage_instrument_dir = os.path.join(self.coverage_dir, 'classes')
    self.coverage_metadata_file = os.path.join(self.coverage_dir, 'coverage.em')
    self.coverage_file = os.path.join(self.coverage_dir, 'coverage.ec')

    self.coverage_report_console = context.options.junit_run_coverage_console
    self.coverage_console_file = os.path.join(self.coverage_dir, 'coverage.txt')

    self.coverage_report_xml = context.options.junit_run_coverage_xml
    self.coverage_xml_file = os.path.join(self.coverage_dir, 'coverage.xml')

    self.coverage_report_html_open = context.options.junit_run_coverage_html_open
    self.coverage_report_html = (
      self.coverage_report_html_open
      or context.options.junit_run_coverage_html
    )
    self.coverage = self.coverage or self.coverage_report_html_open
    self.coverage_html_file = os.path.join(self.coverage_dir, 'html', 'index.html')

    self.flags = []
    if context.options.junit_run_xmlreport or context.options.junit_run_suppress_output:
      if context.options.junit_run_fail_fast:
        self.flags.append('-fail-fast')
      if context.options.junit_run_xmlreport:
        self.flags.append('-xmlreport')
      self.flags.append('-suppress-output')
      self.flags.append('-outdir')
      self.flags.append(self.outdir)

    self.only_write_cmd_line = context.options.only_write_cmd_line
开发者ID:nsanch,项目名称:commons,代码行数:61,代码来源:junit_run.py

示例10: __init__

# 需要导入模块: from twitter.pants.tasks import Task [as 别名]
# 或者: from twitter.pants.tasks.Task import __init__ [as 别名]
    def __init__(self, context):
        Task.__init__(self, context)

        self.url = context.options.confluence_publish_url or context.config.get("confluence-publish", "url")

        self.force = context.options.confluence_publish_force
        self.open = context.options.confluence_publish_open
        self.context.products.require("markdown_html")
开发者ID:satifanie,项目名称:commons,代码行数:10,代码来源:confluence_publish.py

示例11: __init__

# 需要导入模块: from twitter.pants.tasks import Task [as 别名]
# 或者: from twitter.pants.tasks.Task import __init__ [as 别名]
 def __init__(self, context):
   Task.__init__(self, context)
   self.jvm_args = context.config.getlist('scala-repl', 'jvm_args', default=[])
   if context.options.run_jvmargs:
     for arg in context.options.run_jvmargs:
       self.jvm_args.extend(shlex.split(arg))
   self.confs = context.config.getlist('scala-repl', 'confs')
   self.profile = context.config.get('scala-repl', 'profile')
   self.main = context.config.get('scala-repl', 'main')
开发者ID:ilsanbao,项目名称:commons,代码行数:11,代码来源:scala_repl.py

示例12: __init__

# 需要导入模块: from twitter.pants.tasks import Task [as 别名]
# 或者: from twitter.pants.tasks.Task import __init__ [as 别名]
 def __init__(self, context):
   Task.__init__(self, context)
   context.products.require('missing_deps')
   self.transitive = context.options.buildlint_transitive
   self.actions = set(context.options.buildlint_actions)
   # Manually apply the default. Can't use flag default, because action is 'append', so
   # diffs would always be printed, even if we only wanted to rewrite.
   if not self.actions:
     self.actions.add('diff')
开发者ID:lxwuchang,项目名称:commons,代码行数:11,代码来源:build_lint.py

示例13: __init__

# 需要导入模块: from twitter.pants.tasks import Task [as 别名]
# 或者: from twitter.pants.tasks.Task import __init__ [as 别名]
 def __init__(self, context):
     Task.__init__(self, context)
     self.jvm_args = context.config.getlist("scala-repl", "jvm_args", default=[])
     if context.options.run_jvmargs:
         for arg in context.options.run_jvmargs:
             self.jvm_args.extend(shlex.split(arg))
     self.confs = context.config.getlist("scala-repl", "confs")
     self.profile = context.config.get("scala-repl", "profile")
     self.main = context.config.get("scala-repl", "main")
开发者ID:satifanie,项目名称:commons,代码行数:11,代码来源:scala_repl.py

示例14: __init__

# 需要导入模块: from twitter.pants.tasks import Task [as 别名]
# 或者: from twitter.pants.tasks.Task import __init__ [as 别名]
        def __init__(self, context):
          Task.__init__(self, context)

          if not args:
            self.action = lambda targets: action()
          elif len(args) == 1:
            self.action = lambda targets: action(self.context)
          elif len(args) == 2:
            self.action = lambda targets: action(self.context, targets)
          else:
            raise AssertionError('Unexpected fallthrough')
开发者ID:CodeWarltz,项目名称:commons,代码行数:13,代码来源:__init__.py

示例15: __init__

# 需要导入模块: from twitter.pants.tasks import Task [as 别名]
# 或者: from twitter.pants.tasks.Task import __init__ [as 别名]
  def __init__(self, context, classpath=None, workdir=None, nailgun_jar=None, args=None):
    Task.__init__(self, context)

    self._classpath = classpath
    self._nailgun_jar = nailgun_jar or context.config.get('nailgun', 'jar')
    self._ng_server_args = args or context.config.getlist('nailgun', 'args')

    workdir = workdir or context.config.get('nailgun', 'workdir')
    self._pidfile = os.path.join(workdir, 'pid')
    self._ng_out = os.path.join(workdir, 'stdout')
    self._ng_err = os.path.join(workdir, 'stderr')
开发者ID:billwei,项目名称:commons,代码行数:13,代码来源:nailgun_task.py


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