Ejemplo n.º 1
0
    "a7b4fb6f87473467c86de15406e6a094-2079112079.us-east-1.elb.amazonaws.com",
    "34.239.175.232",
)

cloudburst.list()

import random
import string
salt = "".join(random.choices(string.ascii_letters, k=6))

print("Running sanity check")
cloud_sq = cloudburst.register(lambda _, x: x * x, "square-2"+salt)
print(cloud_sq(2).get())
cloudburst.delete_dag("dag")
cloudburst.register_dag("dag", ["square-2"+salt], [])
print(cloudburst.call_dag("dag", {"square-2"+salt: [2]}).get())

# 1 / 0
print("Running example flow")
dataflow = Flow("example-flow"+salt, FlowType.PUSH, cloudburst)
dataflow.map(map_fn, names=["sum"]).filter(filter_fn)

table = Table([("a", IntType), ("b", IntType)])

table.insert([1, 2])
table.insert([1, 3])
table.insert([1, 4])

dataflow.register()
dataflow.deploy()
#!/usr/bin/python3.6

import codecs
import cloudpickle as cp
from cloudburst.client.client import CloudburstConnection

local_cloud = CloudburstConnection('127.0.0.1', '127.0.0.1', local=True)
incr = lambda _, a: a + 1
cloud_incr = local_cloud.register(incr, 'incr')
square = lambda _, a: a * a
cloud_square = local_cloud.register(square, 'square')
local_cloud.register_dag('test_dag', ['incr', 'square'], [('incr', 'square')])
val = local_cloud.call_dag('test_dag', { 'incr': 1 }).get()
print(val)