How to use Riffle - 10 common examples

To help you get started, we’ve selected a few Riffle examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github exis-io / Exis / python / example / test-restart-client.py View on Github external
# Template Setup
import riffle
from riffle import want

riffle.SetFabricLocal()
riffle.SetLogLevelDebug()

class GenericDomain(riffle.Domain):

    def onJoin(self):
        # End Template Setup
        ######################################################################################
        # Example Test Restart before call - Does restarting before a call work?
        import time
        # Trying to restart the node before the call happens, but need to insert artificial delay to make this happen!
        print "___NODERESTART___"
        time.sleep(4.0)
        s = backend.call("restartBeforeC", "Restart before call").wait(str)
        print(s) # Expects a str, like "Restart before call works"
        # End Example Test Restart before call
        
        # Example Test Restart after reg - Does restarting after a register work
        import time
        time.sleep(2.0)
github exis-io / Exis / python / example / test-numeric-client.py View on Github external
class GenericDomain(riffle.Domain):

    def onJoin(self):
        # End Template Setup
        ######################################################################################
        # E-ample Test Reg/Call Big Ints - should be big
        i = backend.call("sendBigInt", 9223372036854775807).wait(int)
        print("{:d}".format(int(i))) # Expects a str, like "9223372036854775807"
        # End E-ample Test Reg/Call Big Ints

        print "___SETUPCOMPLETE___"

# Template Setup
app = riffle.Domain("xs.demo.test") # ARBITER $DOMAIN replaces "xs.demo.test"

client = riffle.Domain("client", superdomain=app)
backend = riffle.Domain("backend", superdomain=app)

GenericDomain("client", superdomain=app).join() # ARBITER $SUBDOMAIN replaces "client"
# End Template Setup
github exis-io / Exis / python / example / test-restart-client.py View on Github external
# Template Setup
import riffle
from riffle import want

riffle.SetFabricLocal()
riffle.SetLogLevelDebug()

class GenericDomain(riffle.Domain):

    def onJoin(self):
        # End Template Setup
        ######################################################################################
        # Example Test Restart before call - Does restarting before a call work?
        import time
        # Trying to restart the node before the call happens, but need to insert artificial delay to make this happen!
        print "___NODERESTART___"
        time.sleep(4.0)
        s = backend.call("restartBeforeC", "Restart before call").wait(str)
        print(s) # Expects a str, like "Restart before call works"
        # End Example Test Restart before call
        
        # Example Test Restart after reg - Does restarting after a register work
github exis-io / Exis / python / example / test-restart-client.py View on Github external
# Template Setup
import riffle
from riffle import want

riffle.SetFabricLocal()
riffle.SetLogLevelDebug()

class GenericDomain(riffle.Domain):

    def onJoin(self):
        # End Template Setup
        ######################################################################################
        # Example Test Restart before call - Does restarting before a call work?
        import time
        # Trying to restart the node before the call happens, but need to insert artificial delay to make this happen!
        print "___NODERESTART___"
        time.sleep(4.0)
        s = backend.call("restartBeforeC", "Restart before call").wait(str)
        print(s) # Expects a str, like "Restart before call works"
        # End Example Test Restart before call
github exis-io / Exis / python / example / test-numeric-client.py View on Github external
# Template Setup
import riffle
from riffle import want

riffle.SetFabricLocal()
riffle.SetLogLevelDebug()

class GenericDomain(riffle.Domain):

    def onJoin(self):
        # End Template Setup
        ######################################################################################
        # E-ample Test Reg/Call Big Ints - should be big
        i = backend.call("sendBigInt", 9223372036854775807).wait(int)
        print("{:d}".format(int(i))) # Expects a str, like "9223372036854775807"
        # End E-ample Test Reg/Call Big Ints

        print "___SETUPCOMPLETE___"

# Template Setup
app = riffle.Domain("xs.demo.test") # ARBITER $DOMAIN replaces "xs.demo.test"
github exis-io / Exis / python / example / test-numeric-backend.py View on Github external
######################################################################################
        # E-ample Test Reg/Call Big Ints - should be big
        @want(int)
        def sendBigInt(i):
            print("{:d}".format(int(i))) # Expects a str, like "9223372036854775807"
            return i
        self.register("sendBigInt", sendBigInt)
        # End E-ample Test Reg/Call Big Ints

        print "___SETUPCOMPLETE___"


# Template Setup
app = riffle.Domain("xs.demo.test")

client = riffle.Domain("client", superdomain=app)
backend = riffle.Domain("backend", superdomain=app)

GenericDomain("backend", superdomain=app).join()
# End Template Setup
github exis-io / Exis / python / example / test-numeric-backend.py View on Github external
        @want(int)
        def sendBigInt(i):
            print("{:d}".format(int(i))) # Expects a str, like "9223372036854775807"
            return i
        self.register("sendBigInt", sendBigInt)
github exis-io / Exis / python / example / test-restart-backend.py View on Github external
# Template Setup
import riffle
from riffle import want

riffle.SetFabricLocal()
riffle.SetLogLevelDebug()

class GenericDomain(riffle.Domain):

    def onJoin(self):
        # End Template Setup
        ######################################################################################
        # Example Test Restart before call - Does restarting before a call work?
        @want(str)
        def restartBeforeC(s):
            print(s) # Expects a str, like "Restart before call"
            return "{} works".format(s)
        self.register("restartBeforeC", restartBeforeC)
        # End Example Test Restart before call
        
        # Example Test Restart after reg - Does restarting after a register work
        import time
github exis-io / Exis / python / example / test-restart-backend.py View on Github external
# Template Setup
import riffle
from riffle import want

riffle.SetFabricLocal()
riffle.SetLogLevelDebug()

class GenericDomain(riffle.Domain):

    def onJoin(self):
        # End Template Setup
        ######################################################################################
        # Example Test Restart before call - Does restarting before a call work?
        @want(str)
        def restartBeforeC(s):
            print(s) # Expects a str, like "Restart before call"
            return "{} works".format(s)
        self.register("restartBeforeC", restartBeforeC)
        # End Example Test Restart before call
        
        # Example Test Restart after reg - Does restarting after a register work
github 4degrees / riffle / test / interactive / browser.py View on Github external
def main(arguments=None):
    '''Interactive test of custom filesystem browser.'''
    if arguments is None:
        arguments = sys.argv

    application = QtGui.QApplication(arguments)

    browser = riffle.browser.FilesystemBrowser()

    screen_size = application.desktop().availableGeometry()
    browser.setMinimumSize(screen_size.width() / 2, screen_size.height() / 2)

    if browser.exec_():
        selected = browser.selected()
        print('Selected: {0}'.format(selected))