[editor] Fix support oozie jobs for tasks.
@@ -44,18 +44,17 @@ def get_statements(hql_query):
def get_current_statement(snippet):
# Multiquery, if not first statement or arrived to the last query
should_close = False
- if not snippet['result'].get('handle'):
- return should_close, {}
- statement_id = snippet['result']['handle'].get('statement_id', 0)
- statements_count = snippet['result']['handle'].get('statements_count', 1)
+ handle = snippet['result'].get('handle', {})
+ statement_id = handle.get('statement_id', 0)
+ statements_count = handle.get('statements_count', 1)
statements = get_statements(snippet['statement'])
statement_id = min(statement_id, len(statements) - 1) # In case of removal of statements
previous_statement_hash = compute_statement_hash(statements[statement_id]['statement'])
- non_edited_statement = previous_statement_hash == snippet['result']['handle'].get('previous_statement_hash') or not snippet['result']['handle'].get('previous_statement_hash')
+ non_edited_statement = previous_statement_hash == handle.get('previous_statement_hash') or not handle.get('previous_statement_hash')
- if snippet['result']['handle'].get('has_more_statements'):
+ if handle.get('has_more_statements'):
should_close = True
if non_edited_statement:
statement_id += 1
