Created
November 5, 2025 03:20
-
-
Save specialorange/db6061f9112aa48f49d69cd9fa2b3647 to your computer and use it in GitHub Desktop.
REAL code that texts the managers daily
This file contains hidden or 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
| # This means its run daily | |
| @shared_task | |
| # Method Name # Arguments | |
| # # This is required | |
| # # This is optional | |
| def updateManagersDaily(fleetSlugs, execution_id=None): | |
| #these are known as docs - notes for humans to | |
| #read about what the method actually does | |
| """ | |
| Process daily updates for multiple accounts/fleets. | |
| Args: | |
| fleetSlugs: List of account/fleet slugs to process | |
| execution_id: Unique ID for tracking this execution | |
| """ | |
| # This says if we dont have a unique odentifier, make one | |
| if not execution_id: | |
| execution_id = str(uuid.uuid4())[:8] | |
| # This logs for reviewing if something goes wrong | |
| # or is needed to be reviewed later | |
| logger.info(f"[{execution_id}] updateManagersDaily processing {len(fleetSlugs)} accounts") | |
| logger.info(f"[{execution_id}] Fleet slugs: {fleetSlugs}") | |
| # the 'job' just gives us a 'handle', something to grab onto | |
| job = group( | |
| # This says call the method that texts the managers daily at 7a | |
| # and send them a customized message | |
| # based on their slug/name (ie goodyear might likely be 'GY') | |
| textTheFleetManagerDaily.s((daily_fleet_message(slug)), slug, execution_id) | |
| for slug in fleetSlugs | |
| )() | |
| # More logs, after some work was done. | |
| # It is common to have a log before and after, that way | |
| # If you get the log BEFORE, but NOT after, you know something | |
| # didn't work out in the middle | |
| logger.info( | |
| f"[{execution_id}] updateManagersDaily completed, {len(fleetSlugs)} tasks dispatched" | |
| ) | |
| # since we have something to grab onto it, we can give it | |
| # back to someone/something for them to use, manipulate, or whatever | |
| return job |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment