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


Python execution_graph.ExecutionGraph类代码示例

本文整理汇总了Python中pants.backend.jvm.tasks.jvm_compile.execution_graph.ExecutionGraph的典型用法代码示例。如果您正苦于以下问题:Python ExecutionGraph类的具体用法?Python ExecutionGraph怎么用?Python ExecutionGraph使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: compile_chunk

  def compile_chunk(self,
                    invalidation_check,
                    compile_contexts,
                    invalid_targets,
                    extra_compile_time_classpath_elements):
    """Executes compilations for the invalid targets contained in a single chunk."""
    assert invalid_targets, "compile_chunk should only be invoked if there are invalid targets."

    # Prepare the output directory for each invalid target, and confirm that analysis is valid.
    for target in invalid_targets:
      cc = compile_contexts[target]
      safe_mkdir(cc.classes_dir)
      self.validate_analysis(cc.analysis_file)

    # Get the classpath generated by upstream JVM tasks and our own prepare_compile().
    classpath_products = self.context.products.get_data('runtime_classpath')

    extra_compile_time_classpath = self._compute_extra_classpath(
        extra_compile_time_classpath_elements)

    # Now create compile jobs for each invalid target one by one.
    jobs = self._create_compile_jobs(classpath_products,
                                     compile_contexts,
                                     extra_compile_time_classpath,
                                     invalid_targets,
                                     invalidation_check.invalid_vts)

    exec_graph = ExecutionGraph(jobs)
    try:
      exec_graph.execute(self._worker_pool, self.context.log)
    except ExecutionFailure as e:
      raise TaskError("Compilation failure: {}".format(e))
开发者ID:cheister,项目名称:pants,代码行数:32,代码来源:jvm_compile.py

示例2: do_compile

  def do_compile(self, invalidation_check, compile_contexts):
    """Executes compilations for the invalid targets contained in a single chunk."""

    invalid_targets = [vt.target for vt in invalidation_check.invalid_vts]
    assert invalid_targets, "compile_chunk should only be invoked if there are invalid targets."

    # This ensures the workunit for the worker pool is set before attempting to compile.
    with self.context.new_workunit('isolation-{}-pool-bootstrap'.format(self.name())) \
            as workunit:
      # This uses workunit.parent as the WorkerPool's parent so that child workunits
      # of different pools will show up in order in the html output. This way the current running
      # workunit is on the bottom of the page rather than possibly in the middle.
      worker_pool = WorkerPool(workunit.parent,
                               self.context.run_tracker,
                               self._worker_count)

    # Prepare the output directory for each invalid target, and confirm that analysis is valid.
    for target in invalid_targets:
      cc = self.select_runtime_context(compile_contexts[target])
      safe_mkdir(cc.classes_dir)

    # Now create compile jobs for each invalid target one by one, using the classpath
    # generated by upstream JVM tasks and our own prepare_compile().
    jobs = self._create_compile_jobs(compile_contexts,
                                     invalid_targets,
                                     invalidation_check.invalid_vts)

    exec_graph = ExecutionGraph(jobs)
    try:
      exec_graph.execute(worker_pool, self.context.log)
    except ExecutionFailure as e:
      raise TaskError("Compilation failure: {}".format(e))
开发者ID:baroquebobcat,项目名称:pants,代码行数:32,代码来源:jvm_compile.py

示例3: compile_chunk

  def compile_chunk(self,
                    invalidation_check,
                    all_targets,
                    relevant_targets,
                    invalid_targets,
                    extra_compile_time_classpath_elements,
                    compile_vts,
                    register_vts,
                    update_artifact_cache_vts_work):
    """Executes compilations for the invalid targets contained in a single chunk."""
    assert invalid_targets, "compile_chunk should only be invoked if there are invalid targets."
    # Get the classpath generated by upstream JVM tasks and our own prepare_compile().
    compile_classpaths = self.context.products.get_data('compile_classpath')

    extra_compile_time_classpath = self._compute_extra_classpath(
        extra_compile_time_classpath_elements)

    compile_contexts = self._create_compile_contexts_for_targets(all_targets)

    # Now create compile jobs for each invalid target one by one.
    jobs = self._create_compile_jobs(compile_classpaths,
                                     compile_contexts,
                                     extra_compile_time_classpath,
                                     invalid_targets,
                                     invalidation_check.invalid_vts_partitioned,
                                     compile_vts,
                                     register_vts,
                                     update_artifact_cache_vts_work)

    exec_graph = ExecutionGraph(jobs)
    try:
      exec_graph.execute(self._worker_pool, self.context.log)
    except ExecutionFailure as e:
      raise TaskError("Compilation failure: {}".format(e))
开发者ID:Gabriel439,项目名称:pants,代码行数:34,代码来源:jvm_compile_isolated_strategy.py

示例4: test_dumps_stack_trace

 def test_dumps_stack_trace(self):
   graph = ExecutionGraph([self.job('A', raising_wrapper, [])], True)
   capturing_logger = CapturingLogger()
   with self.assertRaises(ExecutionFailure):
     graph.execute(ImmediatelyExecutingPool(), capturing_logger)
   error_logs = capturing_logger.log_entries['error']
   self.assertEquals(2, len(error_logs), msg='Wanted one error log, got: {}'.format(error_logs))
   self.assertEquals("A failed: I'm an error", error_logs[0])
   regex = re.compile(
     "Traceback:.*in raising_wrapper.*raise Exception\\(\"I'm an error\"\\)",
     re.DOTALL,
   )
   self.assertRegexpMatches(error_logs[1], regex)
开发者ID:foursquare,项目名称:pants,代码行数:13,代码来源:test_execution_graph.py

示例5: do_compile

  def do_compile(self, invalidation_check, compile_contexts, classpath_product):
    """Executes compilations for the invalid targets contained in a single chunk."""

    invalid_targets = [vt.target for vt in invalidation_check.invalid_vts]
    valid_targets = [vt.target for vt in invalidation_check.all_vts if vt.valid]

    if self.execution_strategy == self.HERMETIC:
      self._set_directory_digests_for_valid_target_classpath_directories(valid_targets, compile_contexts)

    for valid_target in valid_targets:
      cc = self.select_runtime_context(compile_contexts[valid_target])

      classpath_product.add_for_target(
        valid_target,
        [(conf, self._classpath_for_context(cc)) for conf in self._confs],
      )
    self.register_extra_products_from_contexts(valid_targets, compile_contexts)

    if not invalid_targets:
      return

    # This ensures the workunit for the worker pool is set before attempting to compile.
    with self.context.new_workunit('isolation-{}-pool-bootstrap'.format(self.name())) \
            as workunit:
      # This uses workunit.parent as the WorkerPool's parent so that child workunits
      # of different pools will show up in order in the html output. This way the current running
      # workunit is on the bottom of the page rather than possibly in the middle.
      worker_pool = WorkerPool(workunit.parent,
                               self.context.run_tracker,
                               self._worker_count)

    # Prepare the output directory for each invalid target, and confirm that analysis is valid.
    for target in invalid_targets:
      cc = self.select_runtime_context(compile_contexts[target])
      safe_mkdir(cc.classes_dir.path)

    # Now create compile jobs for each invalid target one by one, using the classpath
    # generated by upstream JVM tasks and our own prepare_compile().
    jobs = self._create_compile_jobs(compile_contexts,
                                     invalid_targets,
                                     invalidation_check.invalid_vts,
                                     classpath_product)

    exec_graph = ExecutionGraph(jobs, self.get_options().print_exception_stacktrace)
    try:
      exec_graph.execute(worker_pool, self.context.log)
    except ExecutionFailure as e:
      raise TaskError("Compilation failure: {}".format(e))
开发者ID:jsirois,项目名称:pants,代码行数:48,代码来源:jvm_compile.py

示例6: construct_dependee_graph_str

 def construct_dependee_graph_str(self, jobs, task):
   exec_graph = ExecutionGraph(jobs, task.get_options().print_exception_stacktrace)
   dependee_graph = exec_graph.format_dependee_graph()
   print(dependee_graph)
   return dependee_graph
开发者ID:cosmicexplorer,项目名称:pants,代码行数:5,代码来源:test_rsc_compile.py


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