Skip to content
This repository has been archived by the owner on Nov 6, 2019. It is now read-only.

Avoid collisions in temporary directory names #530

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions run/src/master/master.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,19 @@ trigger_factory = util.BuildFactory(
chunked_steps
)

chunk_result_dir_name = util.Interpolate('/'.join([
'..', 'chunk-results', '%(prop:revision)s', '%(prop:browser_name)s'
]))
chunk_result_file_name = util.Interpolate('/'.join([
'..', 'chunk-results', '%(prop:revision)s', '%(prop:browser_name)s',
# It is possible that no commits are merged to the `master` branch of the Web
# Platform tests project between two regularly-scheduled occurrences of the
# "Initiator" builder. In order to prevent collision of temporary data storage
# locations in these cases, special care should be taken to ensure that
# distinct "chunk results" directory names are used. This is accomplished below
# by including the identifier of the "Initiator" build.
chunk_result_dir_name = util.Interpolate(
'../chunk-results/%(prop:results_id)s'
)
chunk_result_file_name = util.Interpolate(
'../chunk-results/%(prop:results_id)s/' +
'%(prop:this_chunk)s_of_%(prop:total_chunks)s.json'
]))
)
chunked_factory = util.BuildFactory([
steps.Git(repourl='git://github.com/w3c/web-platform-tests'),
temp_dir.CreateStep(name='Create temporary directory'),
Expand Down Expand Up @@ -195,7 +201,8 @@ chunked_factory = util.BuildFactory([
'browser_version': util.Property('browser_version'),
'os_name': util.Property('os_name'),
'os_version': util.Property('os_version'),
'revision_date': util.Property('revision_date')
'revision_date': util.Property('revision_date'),
'results_id': util.Property('results_id')
})
])

Expand Down
8 changes: 6 additions & 2 deletions run/src/master/wpt_chunked_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ def __init__(self, platform_id, platform, total_chunks, *args, **kwargs):

def getSchedulersAndProperties(self):
spec = []
revision = self.build.properties.getProperty('got_revision')
revision_date = self.build.properties.getProperty('revision_date')
browser_name = self.platform['browser_name']
results_id = '%s-%s-%s' % (browser_name, revision, self.build.buildid)

for scheduler in self.schedulerNames:
unimportant = scheduler in self.unimportantSchedulerNames
Expand All @@ -31,12 +34,13 @@ def getSchedulersAndProperties(self):
'this_chunk': this_chunk,
'total_chunks': self.total_chunks,
'platform_id': self.platform_id,
'browser_name': self.platform['browser_name'],
'browser_name': browser_name,
'browser_version': self.platform['browser_version'],
'os_name': self.platform['os_name'],
'os_version': self.platform['os_version'],
'use_sauce_labs': self.platform.get('sauce', False),
'revision_date': revision_date
'revision_date': revision_date,
'results_id': results_id
},
'unimportant': unimportant
})
Expand Down
5 changes: 1 addition & 4 deletions run/src/master/wpt_detect_complete_step.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,12 @@ def __init__(self, *args, **kwargs):
super(WptDetectCompleteStep, self).__init__(*args, **kwargs)

def allResultsPresent(self, step):
browser_name = self.build.properties.getProperty('browser_name')
revision = self.build.properties.getProperty('revision')
total_chunks = self.build.properties.getProperty('total_chunks')
chunk_results_dir = os.path.sep.join([
os.path.abspath(os.path.dirname(__file__)),
'..',
'chunk-results',
revision,
browser_name
self.build.properties.getProperty('results_id')
])
actual = set(os.listdir(chunk_results_dir))
expected = set(
Expand Down