예제 #1
0
파일: python.py 프로젝트: Visomics/Visomics
def run(input):
    task_description = parse_json(input)

    # load inputs into a dictionary
    inputs = {}
    for name, type, format, data in task_description['inputs']:
        inputs[name] = LoadInput(type, format, data)

    # load incoming Python script code into a custom module
    module_code = task_description['script']
    custom = imp.new_module("custom")
    exec module_code in custom.__dict__

    # call the custom Python code and get its output
    outputs = custom.execute(inputs)

    # wrap the output up into a dictionary & return
    output_list = []
    for name, object in outputs.iteritems():
        type = object.GetClassName()
        data = SerializeOutput(object)
        d = {"name": name, "type": type, "data": data}
        output_list.append(d)

    output_json = {"output": output_list}
    return output_json
예제 #2
0
파일: python.py 프로젝트: Visomics/Visomics
def run(input):
  task_description =  parse_json(input);

  # load inputs into a dictionary
  inputs = {}
  for name, type, format, data in task_description['inputs']:
    inputs[name] = LoadInput(type, format, data)

  # load incoming Python script code into a custom module
  module_code = task_description['script']
  custom = imp.new_module("custom")
  exec module_code in custom.__dict__

  # call the custom Python code and get its output
  outputs = custom.execute(inputs)

  # wrap the output up into a dictionary & return
  output_list = []
  for name, object in outputs.iteritems():
    type = object.GetClassName()
    data = SerializeOutput(object)
    d = {"name": name, "type": type, "data": data }
    output_list.append(d)

  output_json = {"output": output_list}
  return output_json
예제 #3
0
def run(input):
    task_description = parse_json(input)

    return execute(task_description['inputs'], task_description['outputs'],
                   task_description['script'])
예제 #4
0
파일: r.py 프로젝트: Visomics/Visomics
def run(input):
    task_description =  parse_json(input);

    return execute(task_description['inputs'], task_description['outputs'],
                   task_description['script'])