timnon / pyschedule

pyschedule - resource scheduling in python
Apache License 2.0
295 stars 61 forks source link

Prevent simultaneous tasks #35

Closed tpaviot closed 6 years ago

tpaviot commented 6 years ago

Thank you @timnon for this interesting project.

In the workflow I've been trying to represent using pyschedule, I have two tasks, let's say T1 and T2, that can't be executed at the same time (i.e. ran parallel) and are unordered (two possible solutions are then T1 then T2 or T2 then T1). How is it possible to represent such a constraint ?

Currently, If I don't specify any constraint, the solver results in a parallel execution. In my mind, the constraint could be written as:

S+ = (T1 < T2) or (T2 < T1)

but this is not interpreted as I want by pyschedule. Any advice ?

timnon commented 6 years ago

Hi, if T1 and T2 turn out to be scheduled in parallel, then they dont share any resource requirement. The solution would be to add an extra resource which is required by both:

R = S.Resource('T1_and_T2_both_need_me_so_they_cant_run_in_parallel')
T1 += R
T2 += R
tpaviot commented 6 years ago

In the meantime, I went to the same conclusion/solution !

Nice project, really, I played for a couple of hours, got a working sample quite easily. Very convincing.

timnon commented 6 years ago

In case you have an example which solves some real-world specific task, i would happy to get a sample for the examples section. There are so far mostly artificial examples.

tpaviot commented 6 years ago

sure I'll do as soon as I have something to share, I'm at the very beginning of a new project. I think I'll also need an importer/exporter (json, xml, yaml I don't know yet).