File tree 4 files changed +42
-9
lines changed
4 files changed +42
-9
lines changed Original file line number Diff line number Diff line change 1
1
CHANGELOG
2
2
`````````
3
3
4
+ Version 1.27.0 -- 2022-08-03
5
+ ----------------------------
6
+ - Modify behavior of acquire-html-dir command
7
+ If a build has finished, then a lock will not be acquired (and
8
+ consequently the path to the HTML directory will not be
9
+ printed to stdout) until the report has finished rendering.
10
+
11
+
4
12
Version 1.26.0 -- 2022-05-18
5
13
----------------------------
6
14
Original file line number Diff line number Diff line change 33
33
TIME_FORMAT_W = "%Y-%m-%dT%H:%M:%SZ"
34
34
TIME_FORMAT_MS = "%Y-%m-%dT%H:%M:%S.%fZ"
35
35
VERSION_MAJOR = 1
36
- VERSION_MINOR = 26
36
+ VERSION_MINOR = 27
37
37
VERSION_PATCH = 0
38
38
RC = False
39
39
@@ -58,6 +58,22 @@ def is_expired(self):
58
58
59
59
60
60
61
+ class ReportRendering :
62
+ """This class is to mark the completion of the report rendering process"""
63
+
64
+ def __init__ (self ):
65
+ self ._touchfile = get_cache_dir ().resolve () / ".litani-completed"
66
+
67
+
68
+ def complete (self ):
69
+ self ._touchfile .touch ()
70
+
71
+
72
+ def has_completed (self ):
73
+ return self ._touchfile .exists ()
74
+
75
+
76
+
61
77
class AcquisitionFailed (Exception ):
62
78
pass
63
79
Original file line number Diff line number Diff line change @@ -448,16 +448,22 @@ async def acquire_html_dir(args):
448
448
end = datetime .datetime .now () + datetime .timedelta (seconds = args .timeout )
449
449
else :
450
450
end = datetime .datetime .max
451
- while True :
451
+ while datetime . datetime . now () <= end :
452
452
html_dir = lib .litani .get_report_dir ().resolve ()
453
453
lockable_dir = lib .litani .LockableDirectory (html_dir )
454
- if lockable_dir .acquire ():
455
- print (html_dir )
456
- sys .exit (0 )
457
- if datetime .datetime .now () > end :
458
- sys .exit (1 )
459
- await asyncio .sleep (1 )
460
-
454
+ if not lockable_dir .acquire ():
455
+ await asyncio .sleep (1 )
456
+ continue
457
+ with open (html_dir / "run.json" ) as handle :
458
+ run = json .load (handle )
459
+ is_completed_run = run ["status" ] != "in_progress"
460
+ if is_completed_run and not litani .ReportRendering ().has_completed ():
461
+ lockable_dir .release ()
462
+ await asyncio .sleep (1 )
463
+ continue
464
+ print (html_dir )
465
+ sys .exit (0 )
466
+ sys .exit (1 )
461
467
462
468
async def print_html_dir (_ ):
463
469
html_dir = lib .litani .get_report_dir ()
Original file line number Diff line number Diff line change @@ -213,6 +213,9 @@ async def run_build(args):
213
213
with litani .atomic_write (args .out_file ) as handle :
214
214
print (json .dumps (run , indent = 2 ), file = handle )
215
215
216
+ report_rendering = litani .ReportRendering ()
217
+ report_rendering .complete ()
218
+
216
219
# Print the path to the complete report at the end of 'litani run-build'.
217
220
# The same path was printed at the start of 'litani init'.
218
221
if 'latest_symlink' in run_info :
You can’t perform that action at this time.
0 commit comments