Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Titus] Option to make chain deterministic #30

Open
rgrinberg opened this issue Jan 23, 2017 · 0 comments
Open

[Titus] Option to make chain deterministic #30

rgrinberg opened this issue Jan 23, 2017 · 0 comments

Comments

@rgrinberg
Copy link

Here's a little example:

from titus.producer import chain
import json

j1 = """
{"input": "int",
 "output": {"type": "record",
            "name": "Output",
            "fields": [{"name": "one", "type": "int"},
                       {"name": "two", "type": "double"},
                       {"name": "three", "type": "string"}]},
 "action":
   {"type": "Output",
    "new": {"one": "input", "two": "input", "three": {"s.int": "input"}}}}
"""

j2 = """
{"input": {"type": "record",
           "name": "Output",
           "fields": [{"name": "one", "type": "int"},
                      {"name": "two", "type": "double"},
                      {"name": "three", "type": "string"}]},
 "output": "string",
 "method": "emit",
 "action": [
   {"emit": "input.three"},
   {"emit": "input.three"},
   {"emit": "input.three"}]}
"""

p1 = json.loads(j1)
p2 = json.loads(j2)

x = chain.json([p1, p2], randseed=1)
y = chain.json([p1, p2], randseed=1)

At the end of this, x ends up being not equal to y. This is quite annoying for testing purposes. Would it be possible to make this function pure? Or at least add an option?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant