sampo.scheduler.generic#

Overview#

Classes#

GenericScheduler

Implementation of a universal scheme of scheduler.

Function#

get_finish_time_default(node, worker_team, node2swork, spec, assigned_parent_time, timeline, work_estimator)

-

Classes#

class sampo.scheduler.generic.GenericScheduler(scheduler_type: sampo.scheduler.base.SchedulerType, resource_optimizer: sampo.scheduler.resource.base.ResourceOptimizer, timeline_type: Type, prioritization_f: Callable[[sampo.schemas.graph.WorkGraph, sampo.schemas.time_estimator.WorkTimeEstimator], list[sampo.schemas.graph.GraphNode]], optimize_resources_f: Callable[[sampo.schemas.graph.GraphNode, list[sampo.schemas.contractor.Contractor], sampo.schemas.schedule_spec.WorkSpec, sampo.schemas.contractor.WorkerContractorPool, dict[sampo.schemas.graph.GraphNode, sampo.schemas.scheduled_work.ScheduledWork], sampo.schemas.time.Time, sampo.scheduler.timeline.base.Timeline, sampo.schemas.time_estimator.WorkTimeEstimator], tuple[sampo.schemas.time.Time, sampo.schemas.time.Time, sampo.schemas.contractor.Contractor, list[sampo.schemas.resources.Worker]]], work_estimator: sampo.schemas.time_estimator.WorkTimeEstimator = DefaultWorkEstimator())#

Bases: sampo.scheduler.base.Scheduler

Implementation of a universal scheme of scheduler. It’s parametrized by prioritization function and optimization resource function. It constructs the end schedulers.

get_default_res_opt_function(get_finish_time=get_finish_time_default) Callable[[sampo.schemas.graph.GraphNode, list[sampo.schemas.contractor.Contractor], sampo.schemas.schedule_spec.WorkSpec, sampo.schemas.contractor.WorkerContractorPool, dict[sampo.schemas.graph.GraphNode, sampo.schemas.scheduled_work.ScheduledWork], sampo.schemas.time.Time, sampo.scheduler.timeline.base.Timeline, sampo.schemas.time_estimator.WorkTimeEstimator], tuple[sampo.schemas.time.Time, sampo.schemas.time.Time, sampo.schemas.contractor.Contractor, list[sampo.schemas.resources.Worker]]]#
schedule_with_cache(wg: sampo.schemas.graph.WorkGraph, contractors: list[sampo.schemas.contractor.Contractor], landscape: LandscapeConfiguration() = LandscapeConfiguration(), spec: sampo.schemas.schedule_spec.ScheduleSpec = ScheduleSpec(), validate: bool = False, assigned_parent_time: sampo.schemas.time.Time = Time(0), timeline: sampo.scheduler.timeline.base.Timeline | None = None) tuple[sampo.schemas.schedule.Schedule, sampo.schemas.time.Time, sampo.scheduler.timeline.base.Timeline, list[sampo.schemas.graph.GraphNode]]#

Extended version of ‘schedule’ method. Returns much inner info about a scheduling process, not only Schedule.

Returns:

resulting schedule, finish time, resulting timeline used for scheduling and node_order used for scheduling

build_scheduler(ordered_nodes: list[sampo.schemas.graph.GraphNode], contractors: list[sampo.schemas.contractor.Contractor], landscape: sampo.schemas.landscape.LandscapeConfiguration = LandscapeConfiguration(), spec: sampo.schemas.schedule_spec.ScheduleSpec = ScheduleSpec(), work_estimator: sampo.schemas.time_estimator.WorkTimeEstimator = DefaultWorkEstimator(), assigned_parent_time: sampo.schemas.time.Time = Time(0), timeline: sampo.scheduler.timeline.base.Timeline | None = None) tuple[Iterable[sampo.schemas.scheduled_work.ScheduledWork], sampo.schemas.time.Time, sampo.scheduler.timeline.base.Timeline]#

Find optimal number of workers who ensure the nearest finish time. Finish time is combination of two dependencies: max finish time, max time of waiting of needed workers This is selected by iteration from minimum possible numbers of workers until then the finish time is decreasing

Parameters:
  • landscape

  • contractors

  • spec – spec for current scheduling

  • ordered_nodes

  • timeline – the previous used timeline can be specified to handle previously scheduled works

  • assigned_parent_time – start time of the whole schedule(time shift)

  • work_estimator

Returns:

Functions#

sampo.scheduler.generic.get_finish_time_default(node, worker_team, node2swork, spec, assigned_parent_time, timeline, work_estimator)#