22-06-2026 2nd commit
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from time import sleep
|
||||
import sys
|
||||
from datetime import date, datetime, timedelta
|
||||
|
||||
@@ -254,4 +254,42 @@ def main():
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
|
||||
for attempt in range(3):
|
||||
try:
|
||||
main()
|
||||
|
||||
with open("Pipeline_config.yml", "r") as f:
|
||||
config = yaml.safe_load(f)
|
||||
|
||||
config["pipeline"]["last_successful_run_date"] = str(date.today())
|
||||
|
||||
with open("Pipeline_config.yml", "w") as f:
|
||||
yaml.safe_dump(config, f, sort_keys=False)
|
||||
|
||||
log.info(
|
||||
f"Pipeline completed successfully. "
|
||||
f"last_successful_run_date={date.today()}"
|
||||
)
|
||||
|
||||
break
|
||||
|
||||
except Exception as e:
|
||||
|
||||
with open("Pipeline_config.yml", "r") as f:
|
||||
config = yaml.safe_load(f)
|
||||
|
||||
config["pipeline"]["run_date"] = str(date.today())
|
||||
|
||||
with open("Pipeline_config.yml", "w") as f:
|
||||
yaml.safe_dump(config, f, sort_keys=False)
|
||||
|
||||
if attempt == 2:
|
||||
raise
|
||||
|
||||
log.warning(
|
||||
f"Pipeline failed. Retry {attempt + 1}/3. Error: {e}"
|
||||
)
|
||||
|
||||
sleep(5)
|
||||
Reference in New Issue
Block a user