Reference¶
Core functions¶
-
class
taskpacker.taskpacker.
Resource
(name, full_name=None, capacity=1)[source]¶ Resources are machines/humans that can perform tasks.
- Parameters
- name
Name of the resource.
- full_name
Full name of the resource.
- capacity
How many jobs a resource can do at the same time.
Methods
hash
to_dict
-
class
taskpacker.taskpacker.
Task
(name, resources, duration, follows=(), max_wait=None, scheduled_start=None, scheduled_resources=None, priority=1, due_time=None, color='blue')[source]¶ Tasks are the steps of a work unit, performed using specific resources.
- Parameters
- name
Name of the task (appears when printed and plotted).
- resources
list of Resource objects specifying the resources occupied by the task.
- duration
Duration of the task (the choice of the unit is left to the user.
- scheduled_resource
Either None or a dict {resource: slot_used}
- Attributes
- scheduled_end
Methods
to_dict
-
taskpacker.taskpacker.
numberjack_scheduler
(tasks, upper_bound=500, lower_bound=None, optimize=True, time_limit=5, solver_method='Mistral', randomization=False, verbose_solver=False)[source]¶ Makes an optimized schedule for the processes.
- Parameters
- tasks
A list of tasks to be sceduled.
- upper_bound
Upper bound for the time. The unit depends on the unit chosen for the duration of the work unit’s tasks.
- optimize
If false, any solution satisfying the constraints (including deadlines) will be returned. But sometimes it is not possible to respect all deadlines. If True, the function will try to return a schedule which minimizes the days over the deadlines. The function minimized is the sum of (wu.priority*wu.delay) for all work units with a due time.
- time_limit
Time in seconds after which the optimizer stops. If the optimizer stops because of this time limit the solution may not be optimal.
- solver_method
The solver used by NumberJack (see NumberJack docs).
Input/Output methods¶
-
taskpacker.io.
plot_schedule
(tasks, legend=False, ax=None, edgewidth=1.0)[source]¶ Plot the work units schedule in a Gantt chart-like way.
This is quite basic and arbitrary and really meant for R&D purposes.
-
taskpacker.io.
plot_tasks_dependency_graph
(tasks, ax=None)[source]¶ Plot the graph of all inter-dependencies in the provided tasks list.
-
taskpacker.io.
plot_tree_graph
(levels, edges, draw_node, elements_positions=None, ax=None, width_factor=2.5, height_factor=2, scale=1.0, edge_left_space=0.015, edge_right_space=0.015, interlevel_shift=0, **txt_kw)[source]¶ General function for plotting tree graphs.
- Parameters
- levels
A list of lists of nodes grouped by “level”, i.e distance to the in the graph to the level 0. levels will be displayed on a same column.
- edges
List of nodes pairs (source node, target node).
- draw_node
A function f(x , y , node, ax, **kw) which draws something related to the node at the position x,y on the given Matplotlib ax.
- ax
The matplotlib ax to use. If none is provided, a new ax is generated.