예제 #1
0
 def runCallable(self, callable, *args, **kwargs):
     "Currently, only works on global functions. Also accepts 'takeSitePackages' kwarg"
     kwargs = dict(kwargs)
     outputTimeout = kwargs.pop('outputTimeout', None)
     unique = self._unique()
     seedGenerator = self._prepareCallable(callable, unique, *args, **kwargs)
     output = invocation.executeWithResult(self._host,
                                           seedGenerator,
                                           unique,
                                           hasInput=True,
                                           outputTimeout=outputTimeout)
     result = invocation.downloadResult(self._host, unique)
     return result, output
예제 #2
0
 def runCallable(self, callable, *args, **kwargs):
     "Currently, only works on global functions. Also accepts 'takeSitePackages' kwarg"
     kwargs = dict(kwargs)
     outputTimeout = kwargs.pop('outputTimeout', None)
     unique = self._unique()
     seedGenerator = self._prepareCallable(callable, unique, *args,
                                           **kwargs)
     output = invocation.executeWithResult(self._host,
                                           seedGenerator,
                                           unique,
                                           hasInput=True,
                                           outputTimeout=outputTimeout)
     result = invocation.downloadResult(self._host, unique)
     return result, output
예제 #3
0
 def runCode(self, code, takeSitePackages=False, outputTimeout=None,
             excludePackages=None, joinPythonNamespaces=True):
     """
     make sure to assign to 'result' in order for the result to come back!
     for example: "runCode('import yourmodule\nresult = yourmodule.func()\n')"
     """
     unique = self._unique()
     seedGenerator = lambda: _creator(invocation.snippetCode(code),
                                      generateDependencies=False,
                                      takeSitePackages=takeSitePackages,
                                      excludePackages=excludePackages,
                                      joinPythonNamespaces=joinPythonNamespaces)()['code']
     output = invocation.executeWithResult(self._host,
                                           seedGenerator,
                                           unique,
                                           hasInput=False,
                                           outputTimeout=outputTimeout)
     result = invocation.downloadResult(self._host, unique)
     return result, output
예제 #4
0
 def runCode(self,
             code,
             takeSitePackages=False,
             outputTimeout=None,
             excludePackages=None,
             joinPythonNamespaces=True):
     """
     make sure to assign to 'result' in order for the result to come back!
     for example: "runCode('import yourmodule\nresult = yourmodule.func()\n')"
     """
     unique = self._unique()
     seedGenerator = lambda: _creator(invocation.snippetCode(code),
                                      generateDependencies=False,
                                      takeSitePackages=takeSitePackages,
                                      excludePackages=excludePackages,
                                      joinPythonNamespaces=
                                      joinPythonNamespaces)()['code']
     output = invocation.executeWithResult(self._host,
                                           seedGenerator,
                                           unique,
                                           hasInput=False,
                                           outputTimeout=outputTimeout)
     result = invocation.downloadResult(self._host, unique)
     return result, output