{"id":20603585,"url":"https://github.com/phaka/phaka.scheduling","last_synced_at":"2025-03-06T16:40:25.222Z","repository":{"id":144174789,"uuid":"96271616","full_name":"Phaka/Phaka.Scheduling","owner":"Phaka","description":"Phaka Scheduling is a class library facilitate the optimally schedule of interdependent activities. ","archived":false,"fork":false,"pushed_at":"2017-07-05T08:07:16.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-17T02:12:02.697Z","etag":null,"topics":["activities","scheduler"],"latest_commit_sha":null,"homepage":null,"language":"C#","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/Phaka.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}},"created_at":"2017-07-05T03:07:21.000Z","updated_at":"2017-07-05T07:57:44.000Z","dependencies_parsed_at":null,"dependency_job_id":"5c378b78-e039-4e5f-973c-2b1ba6931831","html_url":"https://github.com/Phaka/Phaka.Scheduling","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Phaka%2FPhaka.Scheduling","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Phaka%2FPhaka.Scheduling/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Phaka%2FPhaka.Scheduling/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Phaka%2FPhaka.Scheduling/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Phaka","download_url":"https://codeload.github.com/Phaka/Phaka.Scheduling/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242249030,"owners_count":20096781,"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","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":["activities","scheduler"],"created_at":"2024-11-16T09:17:51.508Z","updated_at":"2025-03-06T16:40:25.197Z","avatar_url":"https://github.com/Phaka.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Phaka\n\n## Synopsis\n\nPhaka Scheduling facilitate optimally execution of activities.\n\n## Code Examples\n\n### Scheduling Entire Deployment \n\nLets assume that a deployment consists of five activities, t1, t2, t3, t4 and t5. These activities could be anything, from creating Azure, Amazon AWS or VMware resources to running scripts. \n\n|Activity|Time|Antecedent|\n|:---|:---|:---|\n| t1 | 10ms..100ms | |\n| t2 | 10ms..100ms |t1 |\n| t3 | 10ms..100ms | t2 |\n| t4 | 100ms..200ms | t1 |\n| t5 | 10ms..100ms | t4, t3 |\n\nIf we assume an activity is defined as \n\n```csharp\npublic class Activity : IEquatable\u003cActivity\u003e\n{\n    public Activity(string name) : this(name, TimeSpan.FromMilliseconds(10))\n    {\n    }\n\n    public Activity(string name, TimeSpan delay)\n    {\n        Name = name;\n        Delay = delay;\n    }\n\n    public string Name { get; }\n\n    public TimeSpan Delay { get; }\n\n    public Task ExecuteAsync(CancellationToken cancellationToken = default(CancellationToken))\n    {\n        // Do something real here\n        return Task.Delay(Delay, cancellationToken);\n    }\n\n    public override string ToString()\n    {\n        return Name;\n    }\n\n    public bool Equals(Activity other)\n    {\n        if (ReferenceEquals(null, other)) return false;\n        if (ReferenceEquals(this, other)) return true;\n        return string.Equals(Name, other.Name);\n    }\n\n    public override bool Equals(object obj)\n    {\n        if (ReferenceEquals(null, obj)) return false;\n        if (ReferenceEquals(this, obj)) return true;\n        if (obj.GetType() != this.GetType()) return false;\n        return Equals((Activity) obj);\n    }\n\n    public override int GetHashCode()\n    {\n        return (Name != null ? Name.GetHashCode() : 0);\n    }\n\n    public static bool operator ==(Activity left, Activity right)\n    {\n        return Equals(left, right);\n    }\n\n    public static bool operator !=(Activity left, Activity right)\n    {\n        return !Equals(left, right);\n    }\n}\n```\n\nAnd we created a number of activities\n\n```csharp\nActivity t1 = new Activity(\"t1\"); \nActivity t2 = new Activity(\"t2\"); \nActivity t3 = new Activity(\"t3\"); \nActivity t4 = new Activity(\"t4\", TimeSpan.FromMilliseconds(50)); \nActivity t5 = new Activity(\"t5\");\n```\n\nAnd we configured some dependencies between them.\n\n```csharp\nvar graph = new DependencyGraph\u003cFakeActivity\u003e();\ngraph.AddDependency(t4, t5);\ngraph.AddDependency(t3, t5);\ngraph.AddDependency(t1, t4);\ngraph.AddDependency(t2, t3);\ngraph.AddDependency(t1, t2);\n```\n\n```csharp\nvar target = new Scheduler();\nawait target.ScheduleAsync(graph, t =\u003e t.ExecuteAsync());\n```\n\nIt will then execute the tasks in the correct order, e.g. t1, t2, t4, t3 and t5. \n\n## Installation\n\nTo use Phaka Scheduling in your project, add the nuget package to your project using Visual Studio\n\n    Install-Package Phaka.Scheduling \n\n## Tests\n\nTests are implemented in xUnit\n\n## Contributors\n\n- Werner Strydom\n\n    - Twitter: @bloudraak\n    - Email: hello at wernerstrydom.com\n\n## License\n\nThe MIT License(MIT)\n\nCopyright(c) 2016 Werner Strydom\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphaka%2Fphaka.scheduling","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphaka%2Fphaka.scheduling","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphaka%2Fphaka.scheduling/lists"}