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

expose profiling in a limited way #51

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions myria/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@


class MyriaConnection(object):

"""Contains a connection the Myria REST server."""

_DEFAULT_HEADERS = {
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand Down
7 changes: 5 additions & 2 deletions myria/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@


class MyriaQuery(object):

""" Represents a Myria query """

nonterminal_states = ['ACCEPTED', 'RUNNING']
Expand All @@ -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
Expand Down