Vector Scheduler

@Stefan and team, great forum and really cool project here!

Out of sheer curiosity, can you create and run Vector Scheduler workflows (typically .wfl files) with PyHamilton? If yes, I can’t wait to see an example. If not, how might you try to tackle this especially the handling of parameters for the tasks which will now correspond to Python scripts rather than .hsl files? How would you go about designing activities? Since you still have to use Method Editor for the deck layout, I assume adding resources wouldn’t be an issue though.

1 Like

Hi, thanks for the question.

I’m only a little familiar with the Vector Scheduler. My understanding is it lets you link a sequence of methods together into a larger process. So you have methods A, B, and C, and the scheduler lets you run A->B->C within a single workflow.

There are a lot of options for this in PyHamilton. One possibility is to define each separate method as a function, and call each function sequentially in a Python script. Here’s how this might look:

from pyhamilton import tip_pick_up, aspirate, dispense, tip_eject

def parse_worklist():
    ...

def method_1(num_samples, plate_barcode):
    tip_pick_up(...)
    ...
    tip_eject(...)

def method_2(worklist_path):
    worklist = parse_worklist(...)
    tip_pick_up(...)
    ...
    tip_eject(...)

if __name__ == '__main__':
    with HamiltonInterface(simulate = False) as ham_int:
        method_1(...)
        method_2(...)

Crucially, we can (and should) define these method functions separately in a common repository or library of functions. That way I can arbitrarily orchestrate any set of method functions in any order I want.

The “scheduler” part of the above code is the very last two lines. Let me know if this answers your question and if you’d like any more info.

2 Likes

Once you are in the python ecosystem, you might as well go for a well-tested python scheduler instead (assuming you mean dynamic scheduling rather than just method composition/orchestration), something like User guide — APScheduler 3.9.1 documentation, coupled with parameterised/CLI python calls (using something like click) could work well.

3 Likes

This tool seems perfect, thanks for posting it!

1 Like

What is workflow file (.wfl) file used for? Inside the workflow file, you can select the task method file, and activate the task. So you have to define your task in the method file first, including all pipetting step in venus. But with pyhamilton you write all your steps in python, and there is no method file of task, so you can no run workflow in pyhamilton. If you want to write and run your task and activity in python, you will need dynamic scheduler engine like Hamilton’s scheduler in python.

I haven’t used it but the tool Gareth posted (User guide — APScheduler 3.9.1 documentation ) seems like it would be useful as a dynamic scheduler. I’m sure there are other cases of job schedulers in Python if that isn’t the exact one you need.

This is by far my favorite scheduler: ProcessScheduler — ProcessScheduler 0.9.dev documentation

I wrote a dynamic scheduler using this as a foundation. I’m working on separating it out so others can eventually use it. Nonetheless, this has everything you need to schedule and orchestrate resources.

1 Like