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

bug 1542390: rewrite bugzilla associations crontabber job #4883

Merged
merged 1 commit into from Apr 8, 2019
Merged

bug 1542390: rewrite bugzilla associations crontabber job #4883

merged 1 commit into from Apr 8, 2019

Conversation

willkg
Copy link
Collaborator

@willkg willkg commented Apr 8, 2019

This rewrites the bugzilla association crontabber job as a Django command.
This also adds some needed features in cronrun--it passes the last_success
time now.

This rewrites the bugzilla association crontabber job as a Django command.
This also adds some needed features in cronrun--it passes the last_success
time now.
@@ -14,7 +14,7 @@ set -eo pipefail
./socorro-cmd crontabber --job=archivescraper

# Insert data that's no longer on archive.mozilla.org
./scripts/insert_missing_versions.py
python ./scripts/insert_missing_versions.py
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oops.

start_date = timezone.now() - datetime.timedelta(days=1)
else:
# Try to parse it as a datetime
start_date = parse_datetime(start_date)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

cronrun passes it in as a datetime.

try:
cmd_kwargs = {}
with self.lock_job(job_spec['cmd']):
with self.lock_job(job_spec['cmd']):
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 moved the lock_job context outside all the exception handling. If exceptions happen, then the job will unlock.

if job_spec.get('backfill', False):
# If "backfill" is in the spec, then we want to pass in
# run_time as an argument
cmd_kwargs['run_time'] = format_datetime(run_time)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

These arguments get passed in as strings so the command code can parse them just like any argument.

@willkg
Copy link
Collaborator Author

willkg commented Apr 8, 2019

The big difference here is direct sql code vs. using the BugAssociation model. This was a pretty straight-forward rewrite.

@willkg
Copy link
Collaborator Author

willkg commented Apr 8, 2019

self-r+

@willkg willkg merged commit f9f162d into mozilla-services:master Apr 8, 2019
@willkg willkg deleted the 1542390-bugzilla branch April 9, 2019 00:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant