Skip to content

Commit

Permalink
Make task logic use consistent artifact dir location
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanCoding committed Jan 7, 2022
1 parent a875470 commit 7a3dc15
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions awx/main/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1222,10 +1222,11 @@ def final_run_hook(self, instance, status, private_data_dir, fact_modification_t
Hook for any steps to run after job/task is marked as complete.
"""
instance.log_lifecycle("finalize_run")
job_profiling_dir = os.path.join(private_data_dir, 'artifacts/playbook_profiling')
artifact_dir = os.path.join(private_data_dir, 'artifacts', str(self.instance.id))
job_profiling_dir = os.path.join(artifact_dir, 'playbook_profiling')
awx_profiling_dir = '/var/log/tower/playbook_profiling/'
collections_info = os.path.join(private_data_dir, 'artifacts/', 'collections.json')
ansible_version_file = os.path.join(private_data_dir, 'artifacts/', 'ansible_version.txt')
collections_info = os.path.join(artifact_dir, 'collections.json')
ansible_version_file = os.path.join(artifact_dir, 'ansible_version.txt')

if not os.path.exists(awx_profiling_dir):
os.mkdir(awx_profiling_dir)
Expand Down Expand Up @@ -1979,7 +1980,7 @@ def final_run_hook(self, job, status, private_data_dir, fact_modification_times)
return
if job.use_fact_cache:
job.finish_job_fact_cache(
os.path.join(private_data_dir, 'artifacts', 'fact_cache'),
os.path.join(private_data_dir, 'artifacts', str(job.id), 'fact_cache'),
fact_modification_times,
)

Expand Down Expand Up @@ -2715,7 +2716,7 @@ def post_run_hook(self, inventory_update, status):
return # nothing to save, step out of the way to allow error reporting

private_data_dir = inventory_update.job_env['AWX_PRIVATE_DATA_DIR']
expected_output = os.path.join(private_data_dir, 'artifacts', 'output.json')
expected_output = os.path.join(private_data_dir, 'artifacts', str(inventory_update.id), 'output.json')
with open(expected_output) as f:
data = json.load(f)

Expand Down

0 comments on commit 7a3dc15

Please sign in to comment.