Skip to content
This repository has been archived by the owner on Dec 15, 2018. It is now read-only.

Commit

Permalink
explicitly import BazelTarget into Job and JobStep to prevent errors
Browse files Browse the repository at this point in the history
Summary: This is in response to an error such as https://forge-sentry.pp.dropbox.com/sentry/changes-staging/issues/478/. In particular, because we don't explicitly import the class BazelTarget, there is a possibility that it is not defined at the time when SqlAlchemy is initialized. In the past, it looks like we got lucky...

Test Plan: ran locally

Reviewers: anupc

Reviewed By: anupc

Subscribers: changesbot, kylec

Differential Revision: https://tails.corp.dropbox.com/D224853
  • Loading branch information
Naphat Sanguansin committed Aug 31, 2016
1 parent 92e94b9 commit 453622a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion changes/models/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from changes.db.types.guid import GUID
from changes.db.types.json import JSONEncodedDict
from changes.db.utils import model_repr
from changes.models.bazeltarget import BazelTarget


class Job(db.Model):
Expand Down Expand Up @@ -60,7 +61,7 @@ class Job(db.Model):
project = relationship('Project')
source = relationship('Source')

targets = relationship('BazelTarget', backref=backref('job'))
targets = relationship(BazelTarget, backref=backref('job'))

__repr__ = model_repr('label', 'target')

Expand Down
3 changes: 2 additions & 1 deletion changes/models/jobstep.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from changes.db.types.enum import Enum
from changes.db.types.guid import GUID
from changes.db.types.json import JSONEncodedDict
from changes.models.bazeltarget import BazelTarget


class FutureJobStep(object):
Expand Down Expand Up @@ -69,7 +70,7 @@ class JobStep(db.Model):
project = relationship('Project')
node = relationship('Node')
phase = relationship('JobPhase', backref=backref('steps', order_by='JobStep.date_started'))
targets = relationship('BazelTarget', backref=backref('step'))
targets = relationship(BazelTarget, backref=backref('step'))

__repr__ = model_repr('label')

Expand Down

0 comments on commit 453622a

Please sign in to comment.