Skip to content

Commit

Permalink
Use jvm-compilers as the parent of isolation workunits instead of 'is…
Browse files Browse the repository at this point in the history
…olation', add workunits for analysis

Before the execution graph's time was under isolation for each of the compiler types. This made it harder to see what was going on because the context managed by isolation was only creating the pool of workers. Moving them to have jvm-compilers as a parent means that as each compile runs, it gets appended to the same list even if it is using a different task. This makes it easier to see things over time in the html reporter output

Testing Done:
Ran locally with changes while watching the html output. CI baking on PR.

Bugs closed: 1464

Reviewed at https://rbcommons.com/s/twitter/r/2134/
  • Loading branch information
baroquebobcat committed Apr 29, 2015
1 parent ddd1d39 commit ac64427
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 12 deletions.
Expand Up @@ -195,6 +195,7 @@ def __init__(self, *args, **kwargs):
self.get_options(),
self.workdir,
self.create_analysis_tools(),
self._language,
lambda s: s.endswith(self._file_suffix))

def _jvm_fingerprint_strategy(self):
Expand Down
Expand Up @@ -59,8 +59,9 @@ def register_options(cls, register, language, supports_concurrent_execution):
register('--delete-scratch', default=True, action='store_true',
help='Leave intermediate scratch files around, for debugging build problems.')

def __init__(self, context, options, workdir, analysis_tools, sources_predicate):
super(JvmCompileGlobalStrategy, self).__init__(context, options, workdir, analysis_tools, sources_predicate)
def __init__(self, context, options, workdir, analysis_tools, language, sources_predicate):
super(JvmCompileGlobalStrategy, self).__init__(context, options, workdir, analysis_tools,
language, sources_predicate)

# Various working directories.
# NB: These are grandfathered in with non-strategy-specific names, but to prevent
Expand Down
Expand Up @@ -29,9 +29,9 @@ def register_options(cls, register, language, supports_concurrent_execution):
help='The number of concurrent workers to use compiling {lang} sources with the isolated'
' strategy. This is a beta feature.'.format(lang=language))

def __init__(self, context, options, workdir, analysis_tools, sources_predicate):
def __init__(self, context, options, workdir, analysis_tools, language, sources_predicate):
super(JvmCompileIsolatedStrategy, self).__init__(context, options, workdir, analysis_tools,
sources_predicate)
language, sources_predicate)

# Various working directories.
self._analysis_dir = os.path.join(workdir, 'isolated-analysis')
Expand Down Expand Up @@ -69,15 +69,20 @@ def prepare_compile(self, cache_manager, all_targets, relevant_targets):
# Update the classpath by adding relevant target's classes directories to its classpath.
compile_classpaths = self.context.products.get_data('compile_classpath')

for target in relevant_targets:
cc = self.compile_context(target)
safe_mkdir(cc.classes_dir)
compile_classpaths.add_for_target(target, [(conf, cc.classes_dir) for conf in self._confs])
self.validate_analysis(cc.analysis_file)
with self.context.new_workunit('validate-{}-analysis'.format(self._language)):
for target in relevant_targets:
cc = self.compile_context(target)
safe_mkdir(cc.classes_dir)
compile_classpaths.add_for_target(target, [(conf, cc.classes_dir) for conf in self._confs])
self.validate_analysis(cc.analysis_file)

# This ensures the workunit for the worker pool is set
with self.context.new_workunit('isolation') as workunit:
self._worker_pool = WorkerPool(workunit,
with self.context.new_workunit('isolation-{}-pool-bootstrap'.format(self._language)) \
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.
self._worker_pool = WorkerPool(workunit.parent,
self.context.run_tracker,
self._worker_count)

Expand Down
Expand Up @@ -62,7 +62,8 @@ def register_options(cls, register, language, supports_concurrent_execution):
"""
pass

def __init__(self, context, options, workdir, analysis_tools, sources_predicate):
def __init__(self, context, options, workdir, analysis_tools, language, sources_predicate):
self._language = language
self.context = context
self._analysis_tools = analysis_tools

Expand Down

0 comments on commit ac64427

Please sign in to comment.