Skip to content

Commit

Permalink
Jobs direct ref to replications
Browse files Browse the repository at this point in the history
  • Loading branch information
TheBurchLog committed Jun 7, 2024
1 parent 3056dbd commit 0bfd6bc
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions brewtils/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1209,7 +1209,7 @@ def __init__(
status=None,
max_instances=None,
timeout=None,
replication_id=None,
replication=None,
):
self.id = id
self.name = name
Expand All @@ -1226,7 +1226,7 @@ def __init__(
self.status = status
self.max_instances = max_instances
self.timeout = timeout
self.replication_id = replication_id
self.replication = replication

def __str__(self):
return "%s: %s" % (self.name, self.id)
Expand Down
2 changes: 1 addition & 1 deletion brewtils/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ class JobSchema(BaseSchema):
status = fields.Str(allow_none=True)
max_instances = fields.Int(allow_none=True)
timeout = fields.Int(allow_none=True)
replication_id = fields.Str(allow_none=True)
replication = fields.Nested("ReplicationSchema", allow_none=True)


class JobExportInputSchema(BaseSchema):
Expand Down
1 change: 1 addition & 0 deletions brewtils/test/comparable.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ def assert_job_equal(obj1, obj2, do_raise=False):
deep_fields={
"trigger": partial(assert_trigger_equal, do_raise=True),
"request_template": partial(assert_request_template_equal, do_raise=True),
"replication": partial(assert_replication_equal, do_raise=True),
},
do_raise=do_raise,
)
Expand Down
9 changes: 6 additions & 3 deletions brewtils/test/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ def bg_role(legacy_role_dict):


@pytest.fixture
def job_dict(ts_epoch, request_template_dict, date_trigger_dict):
def job_dict(ts_epoch, request_template_dict, date_trigger_dict, replication_dict):
"""A date job represented as a dictionary."""
return {
"name": "job_name",
Expand All @@ -584,7 +584,7 @@ def job_dict(ts_epoch, request_template_dict, date_trigger_dict):
"status": "RUNNING",
"max_instances": 3,
"timeout": 30,
"replication_id": "123",
"replication": replication_dict,
}


Expand Down Expand Up @@ -642,12 +642,13 @@ def job_dict_for_import(job_dict):


@pytest.fixture
def bg_job(job_dict, ts_dt, bg_request_template, bg_date_trigger):
def bg_job(job_dict, ts_dt, bg_request_template, bg_date_trigger, bg_replication):
"""A job as a model."""
dict_copy = copy.deepcopy(job_dict)
dict_copy["next_run_time"] = ts_dt
dict_copy["trigger"] = bg_date_trigger
dict_copy["request_template"] = bg_request_template
dict_copy["replication"] = bg_replication
return Job(**dict_copy)


Expand All @@ -658,6 +659,7 @@ def bg_cron_job(cron_job_dict, bg_request_template, bg_cron_trigger, ts_dt):
dict_copy["next_run_time"] = ts_dt
dict_copy["trigger"] = bg_cron_trigger
dict_copy["request_template"] = bg_request_template
dict_copy["replication"] = bg_replication
return Job(**dict_copy)


Expand All @@ -668,6 +670,7 @@ def bg_interval_job(interval_job_dict, bg_request_template, bg_interval_trigger,
dict_copy["next_run_time"] = ts_dt
dict_copy["trigger"] = bg_interval_trigger
dict_copy["request_template"] = bg_request_template
dict_copy["replication"] = bg_replication
return Job(**dict_copy)


Expand Down

0 comments on commit 0bfd6bc

Please sign in to comment.