Exemple #1
0
import golem_remote.golem_remote as golem
from golem_remote import GolemClient
from golem_remote.runf_helpers import SubtaskID

##############
# golem init #
##############

shutil.rmtree("abcd", ignore_errors=True)
os.mkdir("abcd")
with open("./abcd/aaa.txt", "w") as f:
    f.write("Wstąpiłem na działo")

golem.init(class_=GolemClient,
           timeout=300,
           task_files={Path("./abcd/aaa.txt")})

#######################
# function definition #
#######################

secret_sauce = "Secret"


@golem.remote
def func(arg1: int,
         arg2: int,
         kwarg1: str = "abc",
         kwarg2: str = "def") -> Tuple[int, str, str, str]:
    time.sleep(1)  # expensive call
import time
from typing import Tuple

import golem_remote.golem_remote as golem
from golem_remote import GolemClient
from golem_remote.runf_helpers import SubtaskID

##############
# golem init #
##############

golem.init(
    class_=GolemClient,
    timeout=300,
)

#######################
# function definition #
#######################

secret_sauce = "Secret"


@golem.remote
def func(arg1: int, arg2: int, kwarg1: str="abc", kwarg2: str="def") \
        -> Tuple[int, str, str]:
    time.sleep(1)  # expensive call
    print(f"Running func: {arg1} {arg2} {kwarg1} {kwarg2}")
    return (arg1 + arg2, kwarg1 + kwarg2, secret_sauce)

Exemple #3
0
from typing import Tuple
import time

# although I will use golemcli at the beginning
# because doing anything with WAMP is so painful
host = "127.0.0.1" 
port = "61000"
golem_dir = "/home/jacek/golem_data/golem4_r"
golemcli = "/home/jacek/golem_orig/golemcli.py"


##############
# golem init #
##############

golem.init(class_=GolemClientMock)

#######################
# function definition #
#######################

secret_sauce = "Secret"

@golem.remote
def func(arg1: int, arg2: int, kwarg1: str="abc", kwarg2: str="def") -> Tuple[int, str]:
    time.sleep(1)  # expensive call    
    print(f"Running func: {arg1} {arg2} {kwarg1} {kwarg2}")
    return (arg1 + arg2, kwarg1 + kwarg2, secret_sauce)

##################
# function calls #
import time

# although I will use golemcli at the beginning
# because doing anything with WAMP is so painful
host: Host = "127.0.0.1"
port: Port = 61000
golem_dir = Path("/home/jacek/golem_data/golem5_r")
golemcli = Path("/home/jacek/golem_orig/golemcli.py")

##############
# golem init #
##############

golem.init(host=host,
           port=port,
           golem_dir=golem_dir,
           class_=GolemClient,
           timeout=300)

#######################
# function definition #
#######################

secret_sauce = "Secret"


@golem.remote
def func(arg1: int, arg2: int, kwarg1: str="abc", kwarg2: str="def") \
        -> Tuple[int, str, str]:
    time.sleep(1)  # expensive call
    print(f"Running func: {arg1} {arg2} {kwarg1} {kwarg2}")
from typing import Tuple
import time

# although I will use golemcli at the beginning
# because doing anything with WAMP is so painful
host = "127.0.0.1"
port = "61000"
golem_dir = "/home/jacek/golem_data/golem4_r"
golemcli = "/home/jacek/golem_orig/golemcli.py"

##############
# golem init #
##############

golem.init(class_=GolemClientQueueMock)

#######################
# function definition #
#######################

secret_sauce = "Secret"


@golem.remote
def func(arg1: int, arg2: int, kwarg1: str="abc", kwarg2: str="def") \
        -> Tuple[int, str, str]:
    time.sleep(1)  # expensive call
    print(f"Running func: {arg1} {arg2} {kwarg1} {kwarg2}")
    return (arg1 + arg2, kwarg1 + kwarg2, secret_sauce)