Esempio n. 1
0
import seamless
seamless.set_ncores(0)
from seamless import communion_server

params = {}
db_host = os.environ.get("SEAMLESS_DATABASE_IP")
if db_host is not None:
    params["host"] = db_host
db_port = os.environ.get("SEAMLESS_DATABASE_PORT")
if db_port is not None:
    params["port"] = db_port
seamless.database_sink.connect(**params)
seamless.database_cache.connect(**params)

communion_server.configure_master(
    transformation_job=True,
    transformation_status=True,
)

import asyncio
asyncio.get_event_loop().run_until_complete(asyncio.sleep(2))

import math
from seamless.highlevel import Context, Cell
import json
ctx = Context()
ctx.pi = math.pi
ctx.doubleit = lambda a: 2 * a
ctx.doubleit.a = ctx.pi
ctx.twopi = ctx.doubleit
ctx.translate()
Esempio n. 2
0
import os
os.environ["SEAMLESS_COMMUNION_ID"] = "jobmaster"
os.environ["SEAMLESS_COMMUNION_INCOMING"] = "localhost:8602"
import seamless
seamless.set_ncores(0)

from seamless import communion_server
communion_server.configure_master(
    buffer=True,
    buffer_status=True,
    transformation_job=True,
    transformation_status=True
)

from seamless.highlevel import load_graph
import sys, json

infile, outfile = sys.argv[1:]
graph = json.load(open(infile))

seamless.database_cache.connect()

ctx = load_graph(graph)

import asyncio
done = asyncio.sleep(1)
asyncio.get_event_loop().run_until_complete(done)

ctx.compute()

colored_graph = ctx.get_graph()
Esempio n. 3
0
if args.no_lru:
    from seamless.core.protocol.calculate_checksum import calculate_checksum_cache, checksum_cache
    from seamless.core.protocol.deserialize import deserialize_cache
    from seamless.core.protocol.serialize import serialize_cache
    calculate_checksum_cache.disable()
    checksum_cache.disable()
    deserialize_cache.disable()
    serialize_cache.disable()

import seamless.shareserver
from seamless import communion_server

communion_server.configure_master({
    "buffer": True,
    "buffer_status": True,
    "buffer_length": True,
    "transformation_job": True,
    "transformation_status": True,
    "semantic_to_syntactic": True,
})

"""
# will not work until load_graph will be much smarter
if args.database:
    communion_server.configure_servant({
        "buffer": False,
        "buffer_status": False,
        "buffer_length": False,
        "transformation_job": False,
        "transformation_status": False,
        "semantic_to_syntactic": False,
        "hard_cancel": False,  # allow others to hard cancel our jobs