Processing a simple workflow in Python -
I am working on a code that takes the dataset and runs some algorithms on it.
User uploads a dataset, and then selects the algorithm to run on this dataset and creates a workflow like this:
workflow = {0: {' Dataset ':' some dataset ', 1: {' algorithm1 ': "parameter"}, 2: {' algorithm2 ': "parameter"}, 3: {' algorithm 3 ': "parameter"}}
which means that I will run the workflow [0]
as my dataset, and I will run it as algorithm1
. After that, I will take the result and I will run the algorithm2
on this result like my new dataset. And I will take new results and run it on algorithm3
This happens to this last item and there is no limit to this workflow.
I am writing it in Python. Can you recommend some strategy about processing this workflow?
You want to run a pipeline on some datasets. It looks like less operation (fold in some languages).
result = less (lambda data, (anonym, p): algo_by_name (anonymous) (p, data), workflow)
This workflow considers (text-oriented so that you can load it with YAML / JSON):
workflow = ['data', ('algo0', {}), '(Algo1 ', {' Param ': value}), ...]
And that looks like your algorithm:
def algo0 (p , Data): ... return_output_filename
takes algo_by_name and gives you an algo function; For example:
def algo_by_name (name): return {'algo0': algo0, 'algo1': algo1,} [name]
( Edit old: If you want a framework to write a pipeline, you can use it as it is like making an instrument, but with progress support and beautiful flow chart.)
Comments
Post a Comment