/usr/share/doc/python3-pyutilib/examples/workflow/example10.py is in python3-pyutilib 5.3.5-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | from pyutilib.workflow import *
class BusyResource(Resource):
def __init__(self, name=None):
resource.Resource.__init__(self)
self._counter = 1
def available(self):
if self._counter > 0:
print("BUSY %d" % self._counter)
self._counter -= 1
return False
return True
class TaskA(pyutilib.workflow.Task):
def __init__(self, *args, **kwds):
pyutilib.workflow.Task.__init__(self, *args, **kwds)
self.inputs.declare('x')
self.outputs.declare('x', self.inputs.x)
def execute(self):
pass
A = TaskA()
A.add_resource(BusyResource())
w = pyutilib.workflow.Workflow()
w.add(A)
print(w(x=1))
|