Created
July 11, 2021 18:34
-
-
Save kuharan/695268a23455fc1c40aaa8efa7125a61 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def calculate_days_since_last_run(all_completed_runs): | |
for run in all_completed_runs: | |
dt1 = datetime.datetime.fromtimestamp(int(time.time())) | |
dt2 = datetime.datetime.fromtimestamp(run['endTime']) | |
rd = dateutil.relativedelta.relativedelta (dt1, dt2) | |
run['time_since_last_sucess_run'] = str(rd.years) + '-' + str(rd.months) + '-' + str(rd.days) + '-' + str(rd.hours) + '-' + str(rd.minutes) | |
return all_completed_runs | |
all_completed_runs = calculate_days_since_last_run(all_completed_runs) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment