{"id":35014160,"url":"https://github.com/mandelsoft/jobscheduler","last_synced_at":"2026-05-19T20:32:05.074Z","repository":{"id":318971849,"uuid":"925433844","full_name":"mandelsoft/jobscheduler","owner":"mandelsoft","description":"A scheduler to run jobs in Go","archived":false,"fork":false,"pushed_at":"2025-10-15T20:50:13.000Z","size":5152,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-16T22:05:03.105Z","etag":null,"topics":["golang","jobs","jobscheduler","scheduler"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mandelsoft.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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-01-31T21:48:33.000Z","updated_at":"2025-10-15T20:50:17.000Z","dependencies_parsed_at":null,"dependency_job_id":"ea4a1937-8a12-4aa2-8b42-a140dc95e304","html_url":"https://github.com/mandelsoft/jobscheduler","commit_stats":null,"previous_names":["mandelsoft/jobscheduler"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/mandelsoft/jobscheduler","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mandelsoft%2Fjobscheduler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mandelsoft%2Fjobscheduler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mandelsoft%2Fjobscheduler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mandelsoft%2Fjobscheduler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mandelsoft","download_url":"https://codeload.github.com/mandelsoft/jobscheduler/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mandelsoft%2Fjobscheduler/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28072771,"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-12-27T02:00:05.897Z","response_time":58,"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":["golang","jobs","jobscheduler","scheduler"],"created_at":"2025-12-27T05:11:08.723Z","updated_at":"2025-12-27T05:11:09.426Z","avatar_url":"https://github.com/mandelsoft.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# A Job Scheduler for Go\n\n\nParallelism in Go can simply be achieved by creating new Go routines.\nThe problem hereby is, that it is not possible to restrict the number\nof parallel executions. This module provides a job scheduler able\nto execute jobs with a limited number of logical processors.\n\nWith additional synchronization elements, like monitors, mutexes or wait groups\nit is possible for jobs to get blocked in a coordinated way, enabling\nother jobs to continue ot start. The scheduler assures that never more than the\nmaximum limit of parallel execution are active.\n\nThe scheduler is provided by package `github.com/mandelsoft/jobscheduler/scheduler`.\nThe package `github.com/mandelsoft/jobscheduler/processors` offers\nspecific synchronization elements usable togetjer with the scheduler\nand package `github.com/mandelsoft/jobscheduler/syncutils` provides\nregular synchronization elements supporting cancellation by a `context.Context`.\n\n```golang\nimport (\n    \"context\"\n    \"fmt\"\n    \"math/rand\"\n    \"time\"\n\n    \"github.com/mandelsoft/jobscheduler/scheduler\"\n)\n\nfunc main() {\n\tsched := scheduler.New(\"demo\")\n\n\tsched.AddProcessor(2)\n\tsched.Run(context.Background())\n\n\td1 := scheduler.DefineJob(\"job1\", scheduler.RunnerFunc(runner1))\n\td2 := scheduler.DefineJob(\"job2\", scheduler.RunnerFunc(runner2))\n\n\tjob1, _ := sched.Apply(d1)\n\tjob2, _ := sched.Apply(d1)\n\tjob3, _ := sched.Apply(d2)\n\n\tjob1.Schedule()\n\tjob3.Schedule()\n\ttime.Sleep(time.Duration((1000 + rand.Intn(100))) * time.Millisecond)\n\tjob2.Schedule()\n\n\tjob1.Wait()\n\tjob2.Wait()\n\tjob3.Wait()\n}\n```\n\nThe scheduler offers an extension model, which can be used to handle\nthe output of the jobs. The extension `progress` provides a visualization\nbased on the progress indicators supported by [`github.com/mandelsoft/ttyprogress`](https://github.com/mandelsoft/ttyprogress).\n\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"examples/jobs/demo2/demo.gif\" alt=\"Job Scheduler Demo\" title=\"Job Scheduler Demo\" /\u003e\n\u003c/p\u003e\n\nThis example can be found in [examples/jobs/demo2/main.go](examples/jobs/demo2/main.go). It works on a recursive data structure, \nprocessing each element with an own job. The execution is limited to 2 active \njobs. The job for every element creates the jobs for the nested elements and\nuses the synchronization operations to wait for their execution.\n\n## Job Nets\n\nInstead of creating single jobs one after the other, the package `scheduler/jobnet`\noffers the possibility to predefine complete sets of jobs  with trigger dependencies\nand execute the net as a whole.\n\nUse `jobnet.DefineNet(name)` to create a new job net. With `jobnet.DefineJob(name, runner)`\njob definitions for the net can be created. They are added to a net by \n`net.AddJob(job)`. The same definition can be added multiple times to the same net, \nbut the should get a new name for each add by calling (`SetName(name)`). Otherwise the\nnew definition for an already configured name will replace the old one.\n\nSpecial condition definitions provided by the same package can be used\nto create conditions (for example dependencies using `DependsOn(...)`). Jobs are\nreferred here by their names used in the composed job net.\n\nJob dependencies MUST NOT be cyclic and all job conditions used in a net must\nresolvable by  the net. This can be checked with the `net.Validate()` call.\n\nThe execution of a job net is implemented by a regular job, which instantiates the\nconfigured jobs with their defined conditions and the waits until those jobs are\nfinished.\n\nA regular scheduler job definition is created with `net.For(payload)`. It is possible\nto create the net for a dedicated payload information. which is passed to the runner.\n\n\nA job net runner is a factory for creating a regular job runner.\nIt gets a `*jobnet.NetContext`, which offers access to the payload and explicit\n(named) triggers created for jobs of this instance of the scheduled job net.\nThe factory then creates a regular job runner for the scheduler job definition,\nwhich is then instantiated for the scheduler by the job net job.\n\nAn example can be found in [`examples/jobs/jobnet`](examples/jobs/jobnet/main.go)\n\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"examples/jobs/jobnet/demo.gif\" alt=\"Job Net Demo\" title=\"Job Net Demo\" /\u003e\n\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmandelsoft%2Fjobscheduler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmandelsoft%2Fjobscheduler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmandelsoft%2Fjobscheduler/lists"}