diff --git a/myria/connection.py b/myria/connection.py index 4c8cbcd..70d1e93 100644 --- a/myria/connection.py +++ b/myria/connection.py @@ -26,6 +26,7 @@ class MyriaConnection(object): + """Contains a connection the Myria REST server.""" _DEFAULT_HEADERS = { @@ -151,7 +152,7 @@ def _make_request(self, method, url, body=None, params=None, if accept == JSON: try: return r.json() - except ValueError: + except ValueError as e: raise MyriaError( 'Error %d: %s' % (r.status_code, r.text)) else: @@ -306,7 +307,7 @@ def upload_source(self, relation_key, schema, source): return self._make_request(POST, '/dataset', json.dumps(body)) def execute_program(self, program, language="MyriaL", server=None, - wait_for_completion=True): + wait_for_completion=True, profile=False): """Execute the program in the specified language on Myria, polling its status until the query is finished. Returns the query status struct. @@ -321,7 +322,7 @@ def execute_program(self, program, language="MyriaL", server=None, rest_url=self._url_start, execution_url=self.execution_url) return raco.execute_query(raco.compile_program( - program, language)) + program, language, profile)) def compile_program(self, program, language="MyriaL", profile=False): """Get a compiled plan for a given program. diff --git a/myria/query.py b/myria/query.py index ea78481..cb3aebe 100644 --- a/myria/query.py +++ b/myria/query.py @@ -12,6 +12,7 @@ class MyriaQuery(object): + """ Represents a Myria query """ nonterminal_states = ['ACCEPTED', 'RUNNING'] @@ -33,14 +34,16 @@ def __init__(self, query_id, connection=None, def submit(query, language="MyriaL", connection=None, timeout=60, - wait_for_completion=True): + wait_for_completion=True, + profile=False): """ Submit a query to Myria and return a new query instance """ connection = connection or MyriaRelation.DefaultConnection return MyriaQuery( connection.execute_program( query, language=language, - wait_for_completion=wait_for_completion)['queryId'], + wait_for_completion=wait_for_completion, + profile=profile)['queryId'], connection, timeout) @staticmethod