Note: #21091 is only a soft blocker for this ticket**
Implement logic in dissolutions job to initiate dissolution for businesses. This will be essentially step 1 in the RFC under the involuntary dissolutions section.
As there are still some unknowns and dependencies, do what you can and flag any issues that come up. We may need to cut additional tickets to address things that cannot be implemented yet.
TODOs
[ ] Implement involuntary dissolutions job logic from step 1 of the tech design (excluding logic to send email and save csv)
To deal with NEW_DISSOLUTIONS_SCHEDULE logic, can use croniter library
[ ] Logic from #21091 will provide code to select businesses but try to implement with some simple placeholder logic to retrieve eligible businesses if you pick this ticket up. Use final implementation from #21091 when it’s ready. Note that the code for #21091 does not take into account for retrieving oldest eligible businesses. And it only retrieves the count so there may need to be some refactoring that needs to be done to share that logic.
[ ] Add appropriate unit tests
Example code that may be useful for checking if job can run today based off of NEW_DISSOLUTIONS_SCHEDULE value
import datetime
from croniter import croniter
def should_run_today(cron_string):
""" Check if the cron_string matches today's date. """
base = datetime.datetime.now()
iter = croniter(cron_string, base)
next_run = iter.get_next(datetime.datetime)
return next_run.date() == base.date()
def main():
# Cron string for running at midnight on Tuesday, Wednesday, and Thursday
cron_string = '0 0 * * 2-4'
if should_run_today(cron_string):
print("Cron job logic runs today.")
else:
print("Cron job logic does not run today.")
if __name__ == "__main__":
main()
Note: #21091 is only a soft blocker for this ticket**
Implement logic in dissolutions job to initiate dissolution for businesses. This will be essentially step 1 in the RFC under the involuntary dissolutions section.
As there are still some unknowns and dependencies, do what you can and flag any issues that come up. We may need to cut additional tickets to address things that cannot be implemented yet.
TODOs
Example code that may be useful for checking if job can run today based off of NEW_DISSOLUTIONS_SCHEDULE value