Esempio n. 1
0
def NestedZapyFile(filename, flowname='flow', **kw):
    with open(getAbsolutePathRelativeToCaller(filename), 'r') as f:
        source = f.read()
    code = compile(source, filename, 'exec')
    module = {}
    exec(code, module)
    flow = module[flowname]
    if not kw.has_key('inputs'):
        kw['inputs'] = {}
    if not kw.has_key('outputs'):
        kw['outputs'] = {}
    for name, type in kw['inputs'].items():
        if name not in flow.input:
            raise RuntimeError('Nested workflow does not have input "%s"' %
                               name)
        nestedDepth = flow.input[name].type.getDepth()
        if type.getDepth() != nestedDepth:
            raise RuntimeError('Input port "%s" depth is %d' %
                               (name, nestedDepth))
    for name, type in kw['outputs'].items():
        if name not in flow.output:
            raise RuntimeError('Nested workflow does not have output "%s"' %
                               name)
        nestedDepth = flow.output[name].type.getDepth()
        if type.getDepth() != nestedDepth:
            raise RuntimeError('Output port "%s" depth is %d' %
                               (name, nestedDepth))
    return NestedWorkflow(flow, **kw)
Esempio n. 2
0
def NestedZapyFile(filename, flowname='flow', **kw):
    with open(getAbsolutePathRelativeToCaller(filename), 'r') as f:
        source = f.read()
    code = compile(source, filename, 'exec')
    module = {}
    exec(code, module)
    flow = module[flowname]
    if not kw.has_key('inputs'):
        kw['inputs'] = {}
    if not kw.has_key('outputs'):
        kw['outputs'] = {}
    for name, type in kw['inputs'].items():
        if name not in flow.input:
            raise RuntimeError('Nested workflow does not have input "%s"' % name)
        nestedDepth = flow.input[name].type.getDepth()
        if type.getDepth() != nestedDepth:
            raise RuntimeError('Input port "%s" depth is %d' % (name, nestedDepth))
    for name, type in kw['outputs'].items():
        if name not in flow.output:
            raise RuntimeError('Nested workflow does not have output "%s"' % name)
        nestedDepth = flow.output[name].type.getDepth()
        if type.getDepth() != nestedDepth:
            raise RuntimeError('Output port "%s" depth is %d' % (name, nestedDepth))
    return NestedWorkflow(flow, **kw)
Esempio n. 3
0
 def file(self, filename, encoding='utf-8', **kw):
     import codecs
     with codecs.open(getAbsolutePathRelativeToCaller(filename), encoding=encoding) as f:
         return RserveServerActivity(self, f.read(), **kw)
Esempio n. 4
0
def BeanshellFile(filename, localDependencies=(), **kw):
    with open(getAbsolutePathRelativeToCaller(filename), 'r') as f:
        script = f.read()
    return BeanshellCode(script, localDependencies, **kw)
Esempio n. 5
0
 def file(self, filename, encoding='utf-8', **kw):
     import codecs
     with codecs.open(getAbsolutePathRelativeToCaller(filename),
                      encoding=encoding) as f:
         return RserveServerActivity(self, f.read(), **kw)
Esempio n. 6
0
def BeanshellFile(filename, localDependencies=(), **kw):
    with open(getAbsolutePathRelativeToCaller(filename), 'r') as f:
        script = f.read()
    return BeanshellCode(script, localDependencies, **kw)