Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

RequestedTaskManager: make sure that database is set properly in peewee models #4777

Merged
merged 1 commit into from
Oct 1, 2019
Merged
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
7 changes: 7 additions & 0 deletions golem/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,9 @@ class RequestedTask(BaseModel):
output_directory = CharField(null=False)
app_params = JsonField(null=False, default=default_dict())

class Meta:
database = db

@property
def deadline(self) -> Optional[datetime.datetime]:
if self.start_time is None:
Expand All @@ -761,6 +764,9 @@ class ComputingNode(BaseModel):
node_id = CharField(primary_key=True)
name = CharField(null=False)

class Meta:
database = db


class RequestedSubtask(BaseModel):
task = ForeignKeyField(RequestedTask, null=False, related_name='subtasks')
Expand All @@ -783,6 +789,7 @@ def deadline(self) -> Optional[datetime.datetime]:
milliseconds=self.task.subtask_timeout) # pylint: disable=no-member

class Meta:
database = db
primary_key = CompositeKey('task', 'subtask_id')


Expand Down