mirror of
https://github.com/ZwareBear/awx.git
synced 2026-04-30 11:51:48 -05:00
When saving JobEvents, include job_created
* this is the partition key * .. used to determine which partition job event rows are sent to
This commit is contained in:
@@ -781,6 +781,7 @@ class BaseTask(object):
|
||||
self.parent_workflow_job_id = None
|
||||
self.host_map = {}
|
||||
self.guid = GuidMiddleware.get_guid()
|
||||
self.job_created = None
|
||||
|
||||
def update_model(self, pk, _attempt=0, **updates):
|
||||
"""Reload the model instance from the database and update the
|
||||
@@ -1158,6 +1159,10 @@ class BaseTask(object):
|
||||
event_data.pop('parent_uuid', None)
|
||||
if self.parent_workflow_job_id:
|
||||
event_data['workflow_job_id'] = self.parent_workflow_job_id
|
||||
# Do we have to check if the field exists? if it doesn't
|
||||
# how will be eventually store the event in the db?
|
||||
if self.job_created:
|
||||
event_data['job_created'] = self.job_created
|
||||
if self.host_map:
|
||||
host = event_data.get('event_data', {}).get('host', '').strip()
|
||||
if host:
|
||||
@@ -1283,6 +1288,10 @@ class BaseTask(object):
|
||||
if self.instance.spawned_by_workflow:
|
||||
self.parent_workflow_job_id = self.instance.get_workflow_job().id
|
||||
|
||||
# TODO: can we count on instance always having created?
|
||||
# If we can't how can we store the job_event?
|
||||
self.job_created = self.instance.created
|
||||
|
||||
try:
|
||||
self.instance.send_notification_templates("running")
|
||||
private_data_dir = self.build_private_data_dir(self.instance)
|
||||
|
||||
Reference in New Issue
Block a user