Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added date to tinderbox filename when human readable date supplied (#181) #411

Merged
merged 7 commits into from Sep 26, 2017

Conversation

Nebelhom
Copy link
Collaborator

@Nebelhom Nebelhom commented Oct 2, 2016

The filename for human-readable code is now prepended by the date format YYYY-MM-DD-

If you decide you want a different format or a universal format (e.g. all timestamps) then please let me know.

Closes #181

@Nebelhom
Copy link
Collaborator Author

Nebelhom commented Oct 2, 2016

@whimboo Could you please have a look? Thanks.

Do you agree to have two different types of filenames for different date formats?

Thanks a lot :)

return '%(TIMESTAMP)s%(BRANCH)s%(DEBUG)s-%(NAME)s' % {
'TIMESTAMP': self.timestamp + '-' if self.timestamp else '',
if not self.timestamp and self.date:
date = self.date.strftime('%Y-%m-%d-')
Copy link
Contributor

@whimboo whimboo Oct 10, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that we should try to always use the timestamp. Shouldn't we be able to here to use it given that we have the subfolder name of the specific build on that day? Please also keep in mind that we can have several tinderbox builds per day, so only the date would cause duplicate filenames. For the latter we should get another test added.

else:
date = ''
# str(...) necessary to create str type else unicode --> test_tinderbox fail
return str('%(TIMESTAMP)s%(BRANCH)s%(DEBUG)s-%(NAME)s' % {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see why we have to use str() here. I would suggest that you get rid of it again, and check where the unicode characters are coming from. I believe its from the self.date.strftimecall which you have added here.

@Nebelhom
Copy link
Collaborator Author

@whimboo Hi, I rewrote the code so that now, every filename from tinderbox has a timestamp as part of the filename except for when a specific locale is defined, because as far as I understand it, self.builds is not defined then...

Once the tests are completed, could you please review? Thank you :)

@@ -819,6 +819,9 @@ def binary_regex(self):

def build_filename(self, binary):
"""Return the proposed filename with extension for the binary."""
if hasattr(self, 'builds'):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should better initialize the builds property to [] in the constructor so that it always exist.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Localized tinderbox builds will indeed not have a subfolder with a timestamp. Those are all in the same folder, and only the last one is kept. So you better check for self.locale_build here.

@whimboo
Copy link
Contributor

whimboo commented Mar 14, 2017

@Nebelhom this PR might miss the upcoming 1.22 release. But will you be able to finish it off?

@whimboo
Copy link
Contributor

whimboo commented Aug 22, 2017

@Nebelhom would you mind to check this again?

@Nebelhom
Copy link
Collaborator Author

Please ignore this run. Rebased it for further work

@coveralls
Copy link

Coverage Status

Coverage increased (+0.02%) to 92.439% when pulling 934b730 on Nebelhom:issue181_tinderboxfilenames into 253b9e2 on mozilla:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage increased (+0.02%) to 92.439% when pulling 934b730 on Nebelhom:issue181_tinderboxfilenames into 253b9e2 on mozilla:master.

@coveralls
Copy link

coveralls commented Aug 23, 2017

Coverage Status

Coverage increased (+0.03%) to 92.45% when pulling 84317ed on Nebelhom:issue181_tinderboxfilenames into 253b9e2 on mozilla:master.

@Nebelhom
Copy link
Collaborator Author

@whimboo Hi could you please review? To my understanding I took all suggested changes into account.

Thanks :)

@Nebelhom Nebelhom dismissed whimboo’s stale review August 23, 2017 16:37

Took all suggested changes into account

@@ -743,6 +743,7 @@ def __init__(self, branch='mozilla-central', build_number=None, date=None,
"""Create instance of a tinderbox scraper."""
self.branch = branch
self.build_number = build_number
self.builds = []
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do not initialize the list for other scrapers in __init__. So I don't think we have to do it here too. We could fix it for all in a separate PR, but that's low priority.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I must have misunderstood you in one of the previous change requests... I thought this is what you asked me to do...
I will remove it again in the next commit...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I see. The comment about that I made Oct last year. So please forgive me that I simply forgot about it. Meanwhile I just want to see as much changes as necessary to actually get this feature working without regressing something else. If we want to initialize self.builds in __init__ then we can/should do it for all scrapers at once in a different PR.

@@ -823,6 +824,9 @@ def binary_regex(self):

def build_filename(self, binary):
"""Return the proposed filename with extension for the binary."""
if not self.locale_build:
self.timestamp = self.builds[self.build_index]

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would only add the timestamp for en-US builds, but localized builds still have the non-prefixed name. See the one test for tinderbox scraper which you didn't update.

So we definitely have to set self.timestamp inside of get_build_info after the call to get_build_info_for_index, which currently only gets executed for en-US.

Maybe we shouldn't care about localized builds given that we do not push those to archive.mozilla.org anymore. Those only exist in Taskcluster.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, could you please let me know whether you want to have this change. The last paragraph stands in strong contrast to the request for change in the paragraphs before...

Sorry, whimboo, it is not clear to me.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think lets leave as it is. We shouldn't care that much about l10n builds on archive.mozilla.org. No-one will be interested in those anyway. So yes, lets leave this code as is.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.01%) to 92.407% when pulling 77eae27 on Nebelhom:issue181_tinderboxfilenames into 253b9e2 on mozilla:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.01%) to 92.407% when pulling 77eae27 on Nebelhom:issue181_tinderboxfilenames into 253b9e2 on mozilla:master.

@whimboo
Copy link
Contributor

whimboo commented Sep 18, 2017

@Nebelhom, I have seen you pushed some updates lately. Is the PR ready again for a review?

@Nebelhom
Copy link
Collaborator Author

@whimboo could you please review after tests are run.

Thanks :)

@@ -800,6 +800,7 @@ def get_build_info(self):
if not self.locale_build:
self.builds, self.build_index = self.get_build_info_for_index(
self.build_index)
self.timestamp = self.builds[self.build_index]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there is no build available, this would raise an exception. Should we allow this? And if yes, how do we handle that?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My assumption was that https://github.com/Nebelhom/mozdownload/blob/7bdceeacc835d958be17ef802eb21e9f1569b222/mozdownload/scraper.py#L908 would raise an issue if there is no build available, so it would never reach this assignment...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, right. So that's fine then. Can you add a comment which explains why we set the timestamp here?

@coveralls
Copy link

Coverage Status

Coverage increased (+0.01%) to 92.396% when pulling 7bdceea on Nebelhom:issue181_tinderboxfilenames into c229985 on mozilla:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage increased (+0.01%) to 92.396% when pulling 7bdceea on Nebelhom:issue181_tinderboxfilenames into c229985 on mozilla:master.

@coveralls
Copy link

coveralls commented Sep 22, 2017

Coverage Status

Coverage increased (+0.01%) to 92.396% when pulling 7bdceea on Nebelhom:issue181_tinderboxfilenames into c229985 on mozilla:master.

@Nebelhom
Copy link
Collaborator Author

@whimboo Thanks for the comments. I have added clarifications in comment form to this PR.

@coveralls
Copy link

coveralls commented Sep 22, 2017

Coverage Status

Coverage increased (+0.01%) to 92.396% when pulling 8942edf on Nebelhom:issue181_tinderboxfilenames into c229985 on mozilla:master.

@@ -800,6 +800,8 @@ def get_build_info(self):
if not self.locale_build:
self.builds, self.build_index = self.get_build_info_for_index(
self.build_index)
# Assigned to provide unique timestamp in filename for each file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rephrase this comment to something like: Always force a timestamp prefix in the filename. With that fixed we can get this landed. It looks all fine. Thanks.

@coveralls
Copy link

coveralls commented Sep 22, 2017

Coverage Status

Coverage increased (+0.01%) to 92.396% when pulling 8c8537a on Nebelhom:issue181_tinderboxfilenames into c229985 on mozilla:master.

@whimboo whimboo merged commit 9007718 into mozilla:master Sep 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants