Skip to content

Remote Functions: continuous output (generators) #38

@psukys

Description

@psukys

Currently trying to run a function that yields results (is a generator), doesn't work.

Remote function file foo.py:

def func():
    for i in range(100):
        yield i


if __name__ == '__channelexec__':
    for item in channel:
        channel.send(eval(item))

Execution code:

import remoto, logging, foo
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger('otherhostname')
conn = remoto.Connection('otherhostname', logger=logger)
remote_foo = conn.import_module(foo)
foo.func()

Received output after executing last line in Execution code:
RuntimeError: DumpError: can't serialize <class 'generator'>

Is there a possible workflow for receiving continuous output from remote function?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions