{"id":29976792,"url":"https://github.com/chifisource/parametricscheduler.jl","last_synced_at":"2026-02-08T06:32:08.353Z","repository":{"id":295316476,"uuid":"989753643","full_name":"ChifiSource/ParametricScheduler.jl","owner":"ChifiSource","description":"A background process / task scheduler for julia.","archived":false,"fork":false,"pushed_at":"2025-05-26T23:55:39.000Z","size":113,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-29T08:37:47.149Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Julia","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ChifiSource.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":["emmaccode","UnformalPenguin"]}},"created_at":"2025-05-24T18:54:19.000Z","updated_at":"2025-05-26T23:55:44.000Z","dependencies_parsed_at":"2025-05-25T07:36:09.511Z","dependency_job_id":null,"html_url":"https://github.com/ChifiSource/ParametricScheduler.jl","commit_stats":null,"previous_names":["chifisource/parametricprocessscheduler.jl","chifisource/parametricscheduler.jl"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ChifiSource/ParametricScheduler.jl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChifiSource%2FParametricScheduler.jl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChifiSource%2FParametricScheduler.jl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChifiSource%2FParametricScheduler.jl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChifiSource%2FParametricScheduler.jl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ChifiSource","download_url":"https://codeload.github.com/ChifiSource/ParametricScheduler.jl/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChifiSource%2FParametricScheduler.jl/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268676024,"owners_count":24288398,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-04T02:00:09.867Z","response_time":79,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-08-04T09:36:46.518Z","updated_at":"2026-02-08T06:32:03.325Z","avatar_url":"https://github.com/ChifiSource.png","language":"Julia","funding_links":["https://github.com/sponsors/emmaccode","https://github.com/sponsors/UnformalPenguin"],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/ChifiSource/image_dump/blob/main/parametricprocesses/parscheduler.png\"\u003e\u003c/img\u003e\n\n  [docs](https://chifidocs.com/parametric/ParametricScheduler)\n  \n\u003c/div\u003e\n\n\n`ParametricScheduler` is used to schedule recurring and one-time tasks from Julia. This fills the role of applications like `Crontab` in systems applications, only in this case facilitated through Julia and its `Dates` `Module`. These tasks can also be scaled using multi-threading and `ParametricProcesses`.\n- getting started\n  - [installing](#installing)\n  - [docs](#docs)\n- usage\n  - [configuration files](#configuration-files)\n  - [api](#api)\n  - [threading](#threading)\n#### installing\nAs *per usual* in [julia](https://julialang.org), installation is done using `Pkg`:\n```julia\nusing Pkg; Pkg.add(\"ParametricScheduler\")\n```\nAlternatively, add `Unstable` for the latest development updates that may occassionally be broken:\n```julia\nusing Pkg; Pkg.add(name = \"ParametricScheduler\", rev = \"Unstable\")\n```\n#### docs\n- We pride ourselves on having REPL-browseable documentation, use `?(ParametricScheduler)` for a full list of available functions.\n- There is also [documentation on chifi docs](https://chifidocs.com/parametric/ParametricScheduler) for this package.\n- For regular usage, **this README** should will enough information on usage. The `ChifiDocs` documentation is primarily for browsing *internal* bindings.\n### configuration files\n`ParametricScheduler` is primarily intended for use *through configuration files*. This package has its own unique formatting for `.cfg` files that are *relatively* straightforward to configure. Each *Task* is represented by a line inside of our `.cfg` file -- missing lines and lines starting with comments are an exception, as are some other special lines. Each `Task` line will start with a number, and this number tells the reader how that task should be read. Lines starting with a `#` will be ignored, and lines can also call `include`, `using`, and `activate` in very specific ways. There are four different task types:\n- **0** A `DateTime` task,\n- **1** a *recurring* `DateTime` task,\n- **2** an **immediate task**,\n- and **3**: A *recurring immediate* task.\n\nFor **0** and **1**, we start by providing the datetime associated with the command. These are 7 unique and ordered numbers, representing\n- 1. Year\n  2. Month\n  3. Day\n  4. Hour\n  5. Minute\n  6. Second\n  7. Millisecond\n\nFor example, the following is at 5 in February, 2025:\n```julia\n# v 0 means datetime task\n0 2025 2 1 5 0 1 0\n```\nfollowing this is ` - ` and the command and arguments. The arguments are separated from the command by another space, and separated from eachother using a `-`.\n```julia\n0 2025 2 1 5 0 1 0 - println \"hello\"-\"hi\"-\"hola\"\n```\nArgument types are somewhat limited, arguments are only parsed as floats, integers, commands, and strings.\nAs for recurring events, they are very similar but also feature two additional numbers alongside the command.\n```julia\n1 _ _ _ _ _ _ _ - _ _ cmd args-...\n```\nThese two additional values represent **the type of interval** and **the interval**. For the type, we use the same number classification from before:\n- 1. Year\n  2. Month\n  3. Day\n  4. Hour\n  5. Minute\n  6. Second\n  7. Millisecond\n \nFor example, thirty seconds from our aforementioned date:\n```julia\n1 2025 2 1 5 0 1 0 - 6 30 sum 5-6\n```\nThe codes two and three remove the dates from the beginning, and will set the date of the task to `now` -- performing the task immediately on startup, and if recurring recurring from there. `2` is non-recurring and `3` is recurring.\n```julia\n# 2 = do immediately...\n\n2 cmd args-\n\n# 3 = do recurringly at x interval\n\n3 _ _ cmd args ...\n```\nConfiguration files also have the ability to load modules into `mod` for multi-threading; when using functions and modules across multiple threads, it will be essential that we `use` those modules or `include` them from files before starting. For more information, see [threading](#threading). We load in our dependencies using `activate`, `using`, and `include` lines. \n```julia\n# sample config\n# activates our environment\nactivate .\n# loads Pkg \nusing Pkg\n# loads `fns.jl`, containing `sampletwo`\ninclude fns.jl\n# every 7 seconds\n3 6 7 sampletwo \"hi! I am running!\"\n2 sampletwo \"immediately runs\"\n# every 24 hours from now, as well as right now\n3 4 24 Pkg.instantiate\n```\nTo start this, we provide our configuration file's path to `ParametricScheduler.start`. This will return a `Scheduler` based on our configuration.\n```julia\nstart(path::String = pwd() * \"config.cfg\", threads::Integer = 1, async::Bool = 1) -\u003e ::Scheduler\n```\nTo start directly from the command line:\n```bash\njulia -e 'using ParametricScheduler; ParametricScheduler.start(\"config.cfg\")'\n```\n### api\n```julia\nstart(scheduler::Scheduler, mods::Any ...; threads::Int64 = 1, async::Bool = true)\nstart(t::Task ..., args ...; keyargs ...)\nstart(path::String = pwd() * \"config.cfg\", mods::Any ...; keyargs ...)\n```\nThough `ParametricScheduler` is primarily intended for use *from configuration files*, it is possible to schedule tasks using the API. We start by creating our time type, which will be either `DateTime` or `RecurringTime`. For a `DateTime`, we provide the same seven values we mentioned before.\n- 1. Year\n  2. Month\n  3. Day\n  4. Hour\n  5. Minute\n  6. Second\n  7. Millisecond\n\n```julia\nusing ParametricScheduler\n# 5 A.M. on the first of January, 2025\nmy_time = DateTime(2025, 1, 1, 5, 0, 0, 0)\n```\nTo create a `RecurringTime`, we provide a start time (another `DateTime`) and an interval from that start time. \n```julia\n#                                                (every hour)\nmy_time = RecurringTime(DateTime(2025, 1, 1, 5, 0, 0, 0), Hour(1))\n```\nAfter creating a time, we call `new_task` to create a task from that time.\n```julia\nnew_task(f::Function, t::Any, args ...; keyargs ...)\n```\n```julia\nmy_task = new_task(println, now(), \"hello scheduler!\")\n```\nNow we can provide this new task to `Scheduler` to create a new `Scheduler`, or we could provide these tasks directly to `start` and get a *started* `Scheduler` in return. When we choose the former, we still need to call `start` on the `Scheduler` to start its process.\n```julia\nunstarted_sched = Scheduler(my_task)\n\nstarted_sched = ParametricScheduler.start(my_task)\n\nstarted_sched2 = ParametricScheduler.start(unstarted_sched)\n```\nThere is also `add_tasks!` and `remove_task!`. `add_tasks!` works as expected, all tasks are provided (not as a `Vector`) directly to this function. `remove_task!` can remove tasks by date or enumeration. The tasks are available via `Scheduler.jobs`.\n```julia\nremove_task!(sched::Scheduler, date::Dates.DateTime)\nremove_task!(sched::Scheduler, num::Int64)\nadd_tasks!(sched::Scheduler, tasks::Task ...)\n```\nFinally, to `close` our scheduler we use `close(::Scheduler)`.\n```julia\nclose(started_sched)\nclose(started_sched2)\n```\nWe can also save a scheduler to a file using `save_config` or read tasks directly from a file using `start`\n### threading\nIt is assumed that **all** assigned functions will be loaded into `Main`; this means including your functions before assigning them as jobs and distributing them. When it comes to multi-threading, we use `mod` arguments to include our functions. This may be done from a configuration file or provided as arguments. Threads will **not** be able to run functions that are not loaded by provided the `Module` or include path to `mods`.\n- `mods` in configuration file:\n```julia\nactivate .\nusing Pkg\ninclude fns.jl\n3 6 7 sampletwo \"hi1\"\n3 6 4 sampletwo \"hi2\"\n3 4 24 Pkg.instantiate\n```\n- `mods` in API:\n```julia\nusing ParametricScheduler\nusing TOML\n# make sure to also include on the main thread (if not, you will get a failed to run task warning):\ninclude(\"fns.jl\")\n# the `mods` key-word argument is specific to this dispatch.\nParametricScheduler.start(sched, new_task(println, now(), \"hello scheduler!\"), mods = [\"fns.jl\", TOML] threads = 4)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchifisource%2Fparametricscheduler.jl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchifisource%2Fparametricscheduler.jl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchifisource%2Fparametricscheduler.jl/lists"}