dbader / schedule

Python job scheduling for humans.
https://schedule.readthedocs.io/
MIT License
11.73k stars 959 forks source link

Named jobs #502

Open enahsor opened 2 years ago

enahsor commented 2 years ago

I'm not sure if this is possible with the current API - I have not seen any documentation supporting this. Is there some way to provide a job with an identifier? eg. I schedule a job called upload-stuff and then I'd be able to refer to that job throughout the lifetime of the schedule. I think this would prove super useful. If you do not think so, please let me know why. If you do agree that this would be useful, I'm open to attempting to implement it.

leirons commented 2 years ago

Ye, i think it would be cool

LuisHenri commented 2 years ago

You can add tags to the Job: https://github.com/dbader/schedule/blob/8a944c845fb837545f990639b227c2bbfd2f53ba/schedule/__init__.py#L443

You can add multiple Tags, but if you add only one, you could use it as its name by using next(iter(job.tags))

rocky4546 commented 2 years ago

Yep, I have been using tags for a while. It has the ability to set and then find the tags. My tags represent a task and then I can have multiple events associated with that tag and pull up all events with a query. It works great.

SijmenHuizenga commented 2 years ago

Hi! Totally agree that it is useful to have a human readable name attached to a job. This is what tags are intended for. Is there is anything specific that you would like to achieve that can't be done without tags?