task
¶
Module Contents¶
-
class
task.
Entity
(uid=None, name="")¶ Base class for entities which provides a UUID and a hashability to the child classes
-
uid
¶ UUID – The UUID of the object
-
name
¶ str – The name of the object
Parameters: - uid (UUID, optional) – The UUID of the object
- name (str, optional) – The name of the object
-
__init__
(uid=None, name="")¶
-
__eq__
(other)¶
-
__hash__
()¶
-
__repr__
()¶
-
-
class
task.
Task
(name, uid=None, project_uid=None, duration_pdf=None, earliest_start_date_pdf=None, latest_finish_date_pdf=None, data=None, deadline_weight=1)¶ A task in the project or overall process
-
project_uid
¶ UUID – The UUID of the project containing this task
-
duration_pdf
¶ projectpredict.pdf.DurationPdf – A pdf to use to sample the duration of the task
-
earliest_start_date_pdf
¶ projectpredict.pdf.DatePdf – A pdf to use to sample the earliest start date of of the task
-
latest_finish_date_pdf
¶ projectpredict.pdf.DatePdf – A pdf to use to sample the latest finish date of the task
-
start_time
¶ datetime – The datetime the task was started
-
completion_time
¶ datetime – The datetime the task was completed
-
data
¶ Any data associated with this task.
-
deadline_weight
¶ The weight attached to the deadline for this task.
Parameters: - name (str) – The name of the task
- uid (UUID, optional) – The UUID of the task. If none is provided, one will be generated.
- project_uid (UUID, optional) – The UUID of the project containing this task
- duration_pdf (projectpredict.pdf.DurationPdf) – A pdf to use to sample the duration of the task
- earliest_start_date_pdf (DatePdf, optional) – A pdf to use to sample the earliest start date of of the task
- latest_finish_date_pdf (DatePdf, optional) – A pdf to use to sample the latest finish date of the task
- data (optional) – Any data associated with this task.
- deadline_weight (int, optional) – The weight attached to meeting this task’s deadline
-
__init__
(name, uid=None, project_uid=None, duration_pdf=None, earliest_start_date_pdf=None, latest_finish_date_pdf=None, data=None, deadline_weight=1)¶
-
start
(start_time=None)¶ Marks the task as started
Parameters: start_time (datetime, optional) – The datetime the task was started. Defaults to the current UTC timestamp
-
complete
(completion_time=None)¶ Completes the task
Parameters: completion_time (datetime, optional) – The datetime the task was completed. Defaults to the current UTC timestamp
-
is_completed
()¶ bool: Is the task completed?
-
is_started
()¶ bool: Has the task been started?
-
mean_duration
()¶ timedelta: Gets the mean of the duration pdf
-
set_duration_pdf
(model)¶ Sets the duration PDF from a model
Parameters: model – The model to use to predict the duration of the task
-
set_earliest_start_pdf
(mean_datetime, std, units=None)¶ Sets the earliest start date pdf as a normal distributirequired=Trueon about a mean date.
Parameters: - mean_datetime (datetime) – The mean datetime of the earliest time a task can start
- std (float) – The standard deviation of the distribution
- units (TimeUnits, optional) – The units of time of the variance. Defaults to TimeUnits.seconds
-
set_latest_finish_pdf
(mean_datetime, std, units=None)¶ Sets the latest finish date pdf as a normal distribution about a mean date.
Parameters: - mean_datetime (datetime) – The mean datetime of the latest time a task can finish
- std (float) – The standard deviation of the distribution
- units (TimeUnits, optional) – The units of time of the variance. Defaults to TimeUnits.seconds
-
get_duration_sample
(current_time)¶ Gets a sample of the duration.
If the task has already started, then only durations greater than current_time - start_time will be valid, and samples will be drawn until a valid duration is picked.
Parameters: current_time (datetime) – The current time at which the sample should be drawn from. Returns: A sample of the duration pdf Return type: timedelta
-
get_earliest_start_sample
(current_time)¶ Gets a sample of the earliest start date pdf
If a task has been started, this will always return the start time. Else if an earliest start date pdf has been provided, a sample is drawn from that distribution. If no distribution has ben provided, the current time is returned.
Parameters: current_time (datetime) – The current time at which the sample should be drawn from. Returns: A sample from the earliest start date pdf. Return type: datetime
-
get_latest_finish_sample
()¶ Gets a sample of the latest finish date pdf
If an latest finish date pdf has been provided, a sample is drawn from that distribution. else, this function will return None
Returns: A sample from the latest start date pdf Return type: datetime
-
from_pert
(name, best_case, estimated, worst_case, units=None, **kwargs)¶ Constructs a Task from three-point (PERT) estimations.
Parameters: - name (str) – The name of the task
- best_case (float) – The estimated best case duration of the task
- estimated (float) – The estimated duration of the task
- worst_case (float) – The estimated worst case duration of the task
- units (TimeUnits, optional) – The units of time used in the estimation. Defaults to TimeUnits.seconds
- **kwargs – Arguments to be passed into Task constructor
Returns: A task constructed from the provided arguments
Return type:
-