sampo.scheduler.timeline.just_in_time_timeline#

Overview#

Classes#

JustInTimeTimeline

Timeline that stored the time of resources release.

Classes#

class sampo.scheduler.timeline.just_in_time_timeline.JustInTimeTimeline(tasks: Iterable[sampo.schemas.graph.GraphNode], contractors: Iterable[sampo.schemas.contractor.Contractor], worker_pool: sampo.schemas.contractor.WorkerContractorPool, landscape: sampo.schemas.landscape.LandscapeConfiguration)#

Bases: sampo.scheduler.timeline.base.Timeline

Timeline that stored the time of resources release. For each contractor and worker type store a descending list of pairs of time and number of available workers of this type of this contractor.

find_min_start_time_with_additional(node: sampo.schemas.graph.GraphNode, worker_team: list[sampo.schemas.resources.Worker], node2swork: dict[sampo.schemas.graph.GraphNode, sampo.schemas.scheduled_work.ScheduledWork], spec: sampo.schemas.schedule_spec.WorkSpec, assigned_start_time: sampo.schemas.time.Time | None = None, assigned_parent_time: sampo.schemas.time.Time = Time(0), work_estimator: sampo.schemas.time_estimator.WorkTimeEstimator = DefaultWorkEstimator()) tuple[sampo.schemas.time.Time, sampo.schemas.time.Time, dict[sampo.schemas.graph.GraphNode, tuple[sampo.schemas.time.Time, sampo.schemas.time.Time]]]#

Define the nearest possible start time for the current job. It is equal the max value from: 1. end time of all parent tasks, 2. time previous job off all needed workers to complete the current task.

Parameters:
  • assigned_parent_time – minimum start time

  • assigned_start_time

  • node – the GraphNode whose minimum time we are trying to find

  • worker_team – the worker team under testing

  • node2swork – dictionary, that match GraphNode to ScheduleWork respectively

  • spec – given work specification

  • work_estimator – function that calculates execution time of the GraphNode

Returns:

start time, end time, None(exec_times not needed in this timeline)

update_timeline(finish_time: sampo.schemas.time.Time, node: sampo.schemas.graph.GraphNode, node2swork: dict[sampo.schemas.graph.GraphNode, sampo.schemas.scheduled_work.ScheduledWork], worker_team: list[sampo.schemas.resources.Worker], spec: sampo.schemas.schedule_spec.WorkSpec)#

Adds given worker_team to the timeline at the moment finish

Parameters:
  • finish_time

  • node

  • node2swork

  • worker_team

  • spec – work specification

Returns:

schedule(node: sampo.schemas.graph.GraphNode, node2swork: dict[sampo.schemas.graph.GraphNode, sampo.schemas.scheduled_work.ScheduledWork], workers: list[sampo.schemas.resources.Worker], contractor: sampo.schemas.contractor.Contractor, spec: sampo.schemas.schedule_spec.WorkSpec, assigned_start_time: sampo.schemas.time.Time | None = None, assigned_time: sampo.schemas.time.Time | None = None, assigned_parent_time: sampo.schemas.time.Time = Time(0), work_estimator: sampo.schemas.time_estimator.WorkTimeEstimator = DefaultWorkEstimator())#

Schedules the given GraphNode using passed agents, spec and times. If start time not passed, it should be computed as minimum work start time. :return: scheduled finish time of given work

__getitem__(item: sampo.schemas.types.AgentId)#
_schedule_with_inseparables(node: sampo.schemas.graph.GraphNode, node2swork: dict[sampo.schemas.graph.GraphNode, sampo.schemas.scheduled_work.ScheduledWork], workers: list[sampo.schemas.resources.Worker], contractor: sampo.schemas.contractor.Contractor, spec: sampo.schemas.schedule_spec.WorkSpec, inseparable_chain: list[sampo.schemas.graph.GraphNode], start_time: sampo.schemas.time.Time, exec_times: dict[sampo.schemas.graph.GraphNode, tuple[sampo.schemas.time.Time, sampo.schemas.time.Time]], work_estimator: sampo.schemas.time_estimator.WorkTimeEstimator = DefaultWorkEstimator())#

Makes ScheduledWork object from GraphNode and worker list, assigned start_end_time and adds it to given node2swork. Also does the same for all inseparable nodes starts from this one

Parameters:
  • node

  • node2swork

  • workers

  • contractor

  • spec

  • inseparable_chain

  • start_time

  • exec_times

  • work_estimator

Returns: