{"id":13936151,"url":"https://github.com/Edinburgh-Genome-Foundry/Taskpacker","last_synced_at":"2025-07-19T21:31:47.630Z","repository":{"id":151849749,"uuid":"93082590","full_name":"Edinburgh-Genome-Foundry/Taskpacker","owner":"Edinburgh-Genome-Foundry","description":":school_satchel: Simple schedule optimization library for Python","archived":false,"fork":false,"pushed_at":"2020-09-25T15:24:57.000Z","size":7671,"stargazers_count":148,"open_issues_count":0,"forks_count":12,"subscribers_count":16,"default_branch":"master","last_synced_at":"2025-07-15T09:03:02.740Z","etag":null,"topics":["lab-automation","numberjack","scheduling","scheduling-algorithms"],"latest_commit_sha":null,"homepage":"https://edinburgh-genome-foundry.github.io/Taskpacker/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Edinburgh-Genome-Foundry.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":null,"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-06-01T17:29:09.000Z","updated_at":"2025-04-16T20:02:04.000Z","dependencies_parsed_at":"2023-05-12T09:15:45.166Z","dependency_job_id":null,"html_url":"https://github.com/Edinburgh-Genome-Foundry/Taskpacker","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Edinburgh-Genome-Foundry/Taskpacker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Edinburgh-Genome-Foundry%2FTaskpacker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Edinburgh-Genome-Foundry%2FTaskpacker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Edinburgh-Genome-Foundry%2FTaskpacker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Edinburgh-Genome-Foundry%2FTaskpacker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Edinburgh-Genome-Foundry","download_url":"https://codeload.github.com/Edinburgh-Genome-Foundry/Taskpacker/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Edinburgh-Genome-Foundry%2FTaskpacker/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266019657,"owners_count":23864916,"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":["lab-automation","numberjack","scheduling","scheduling-algorithms"],"created_at":"2024-08-07T23:02:25.215Z","updated_at":"2025-07-19T21:31:47.582Z","avatar_url":"https://github.com/Edinburgh-Genome-Foundry.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":".. raw:: html\n\n    \u003cp align=\"center\"\u003e\n    \u003cimg alt=\"Taskpacker Logo\" title=\"Taskpacker Logo\" src=\"https://raw.githubusercontent.com/Edinburgh-Genome-Foundry/Taskpacker/master/docs/_static/images/title.png\" width=\"600\"\u003e\n    \u003cbr /\u003e\u003cbr /\u003e\n    \u003c/p\u003e\n\nTaskpacker is a generic schedule optimization and visualization library for Python.\nFor instance, below is an optimized schedule where 20 processes (each comprised of several tasks and represented by one color) are ran 24/7 in a factory:\n\n.. image:: https://raw.githubusercontent.com/Edinburgh-Genome-Foundry/Taskpacker/master/examples/dna_assembly.png\n :alt: [dna_assembly.png]\n :align: center\n :width: 600px\n\nSuch plots enable you to spot the bottlenecks of your factory. In this example,\nit appears that ovens are the limiting elements (the only machines packed full\nwith no downtime) and that buying a third oven will increase your factory's\nthroughput.\n\nMain features\n--------------\n\nTaskpacker was built as a toy project to have an easily-extensible scheduling tool in Python.\nOnly Python2 is supported right now (sorry for that, there is a complex bug with Numberjack in Python3).\nIt is pretty simple and limited (the core code is ~200 lines) but comes with enough features to cover many cases:\n\n- Supports resources (typically, people or robots) and resource capacity\n  (= how much jobs a resource can do at the same time)\n- Supports tasks dependencies (some tasks must be finished before other tasks\n  can be started) and maximum waiting time (i.e. some tasks must be started at the\n  latest X minutes after their *parents* are completed)\n- Supports pre-scheduled tasks (such as breaks for human operators, scheduled robotic maintenance etc.)\n\nWork in progress - contribute !\n------------------------------------------\n\nTaskpacker is an open-source software originally written to optimize the robot-operated DNA assembly operations at the `Edinburgh Genome Foundry \u003chttp://www.genomefoundry.io\u003e`_. It is `released on Github \u003chttps://github.com/Edinburgh-Genome-Foundry/plateo\u003e`_\nunder the MIT licence (¢ Edinburgh Genome Foundry), with no warranties: this is\nan experimental piece of software which we hope will be as useful for you as it was for us.\nAnd everyone is welcome to contribute !\n\nInstallation\n--------------\n\nTaskpacker can be installed by unzipping the source code in one directory and using this command: ::\n\n    sudo python setup.py install\n\nYou can also install it directly from the Python Package Index with this command: ::\n\n    sudo pip taskpacker install\n\nIt is probable that you will need some dependencies to build Numberjack. On Ubuntu you can install these with: ::\n\n    sudo apt install libxml2-dev swig\n\nBasic Example\n--------------\n\nIn this example two labbies have been assigned a list of chores.\nAlice will visit the GMO plants, cook the hamsters, and feed the gremlins.\nBob will clean the scalpels, dice the hamsters once they are cooked, then\nassist Alice in gremlins feeding (a task that takes two people).\nCertain tasks can only be done after other tasks have been completed.\nAlice has a stereotypical predisposition to multitasking: she can do 2 jobs at\nthe same time, while Bob can't.\n\nHere is how you would use Taskpacker to find when they will do each task so as\nto finish as early as possible:\n\n.. code:: python\n\n    from taskpacker import Task, Resource, numberjack_scheduler, plot_schedule\n    alice = Resource(\"Alice\", capacity=2)\n    bob = Resource(\"Bob\", capacity=1)\n\n\n\n    clean_scalpels = Task(\"Clean the scalpels\", resources=[bob], duration=20,\n                          color=\"white\")\n    visit_plants = Task(\"Visit the plants\", resources=[alice], duration=60,\n                         color=\"yellow\")\n    cook_hamsters = Task(\"Cook the hamsters\", resources=[alice], duration=30,\n                         color=\"red\")\n    dice_hamsters = Task(\"Dice the hamsters\", resources=[bob], duration=40,\n                         color=\"blue\", follows=[cook_hamsters, clean_scalpels])\n    feed_gremlins = Task(\"Feed the gremlins\", resources=[alice, bob], duration=50,\n                         color=\"orange\", follows=[dice_hamsters])\n\n\n    all_tasks = [clean_scalpels, visit_plants, cook_hamsters, dice_hamsters,\n                 feed_gremlins]\n    scheduled_tasks = numberjack_scheduler(all_tasks)\n    fig, ax = plot_schedule(scheduled_tasks)\n    ax.figure.set_size_inches(7, 3)\n    ax.figure.savefig(\"alice_and_bod.png\", bbox_inches=\"tight\")\n\nModeling tasks and reources with spreadsheets\n---------------------------------------------\n\nAssume that you have a process consisting in several tasks, each task depending\non some resources to be available, and possibly on other tasks. Such process can\nbe summarized in a spreadsheet like this one `this file \u003c\u003e`_, which is loaded in\nTaskpacker as follows:\n\n.. code:: python\n\n    from taskpacker import (get_resources_from_spreadsheet,\n                            get_process_from_spreadsheet)\n\n    resources = get_resources_from_spreadsheet(\n        spreadsheet_path=\"path/to/spreadsheet.xls\", sheetname=\"resources\")\n\n    process_tasks = get_process_from_spreadsheet(\n        spreadsheet_path=\"path/to/spreadsheet.xls\",\n        sheetname=\"process\",\n        resources_dict=resources\n    )\n\n\nThen you can for instance plot the dependency graph of the tasks:\n\n.. code:: python\n\n    from taskpacker import plot_tasks_dependency_graph\n    plot_tasks_dependency_graph(process_tasks)\n\n.. image:: https://raw.githubusercontent.com/Edinburgh-Genome-Foundry/Taskpacker/master/docs/_static/images/process_plan.png\n   :alt: [logo]\n   :align: center\n   :width: 600px\n\nOr simply schedule the tasks:\n\n.. code:: python\n\n    from taskpacker import numberjack_scheduler\n    scheduled_tasks = numberjack_scheduler(process_tasks)\n\n\nThroughput estimations\n-----------------------\n\nGiven a list of tasks forming a process, you might ask \"how many of these processes\ncan my factory run in a day ?\". The following code loads 20 of these processes\nand asks Taskpacker to stack them one by one as compactly as possible:\n\n.. code:: python\n\n    from taskpacker import (get_process_from_spreadsheet,\n                            get_resources_from_spreadsheet,\n                            schedule_processes_series,\n                            plot_tasks_dependency_tree,\n                            plot_schedule, Task)\n    import matplotlib.cm as cm\n\n\n    colors = [cm.Paired(0.21 * i % 1.0) for i in range(30)]\n\n    resources = get_resources_from_spreadsheet(\n        spreadsheet_path=\"path/to/spreadsheet.xls\", sheetname=\"resources\")\n\n    processes = [\n        get_process_from_spreadsheet(spreadsheet_path=\"path/to/spreadsheet.xls\",\n                                     sheetname=\"process\",\n                                     resources_dict=resources,\n                                     tasks_color=colors[i],\n                                     task_name_prefix=\"WU%d_\" % (i + 1))\n        for i in range(20)\n    ]\n\n    # OPTIMIZE THE SCHEDULE\n    new_processes = schedule_processes_series(\n        processes, est_process_duration=5000, time_limit=5)\n\n    # PLOT THE OPTIMIZED SCHEDULE\n\n    all_tasks = [t for process in new_processes for t in process]\n    fig, ax = plot_schedule(all_tasks)\n    ax.set_xlabel(\"time (min)\")\n    ax.figure.savefig(\"dna_assembly_schedule.png\", bbox_inches=\"tight\")\n\n.. image:: https://raw.githubusercontent.com/Edinburgh-Genome-Foundry/Taskpacker/master/examples/dna_assembly.png\n :alt: [dna_assembly.png]\n :align: center\n :width: 600px\n\nNote that it is also possible to add scheduled breaks (here we make them appear as white rectangles) so that your Igor can rest:\n\n.. code:: python\n\n    scheduled_breaks = [\n        Task(\"break_%03d\" % i,\n             resources=[resources[\"igor\"]],\n             scheduled_resource={resources[\"igor\"]: 1},\n             duration=12 * 60, # The break lasts 12H\n             scheduled_start=24 * 60 * i, # The break happens every 24H\n             color='white')\n        for i in range(6)\n    ]\n\n    new_processes = schedule_processes_series(\n        processes, est_process_duration=5000, time_limit=5,\n        scheduled_tasks=scheduled_breaks)\n\n.. image:: https://raw.githubusercontent.com/Edinburgh-Genome-Foundry/Taskpacker/master/examples/dna_assembly_with_breaks.png\n :alt: [dna_assembly_with_breaks.png]\n :align: center\n :width: 600px\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FEdinburgh-Genome-Foundry%2FTaskpacker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FEdinburgh-Genome-Foundry%2FTaskpacker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FEdinburgh-Genome-Foundry%2FTaskpacker/lists"}