Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacob Beck committed Apr 3, 2019
1 parent 3b35734 commit 2654c79
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
3 changes: 1 addition & 2 deletions core/dbt/rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,7 @@ def process_listing(self, active=True, completed=False):
))
table.sort(key=lambda r: (r.state, r.start))
result = {
'columns': list(TaskRow._fields),
'rows': [list(r) for r in table],
'rows': [dict(r._asdict()) for r in table],
}
return result

Expand Down
12 changes: 4 additions & 8 deletions test/integration/042_sources_test/test_sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -696,8 +696,7 @@ def test_ps_kill_postgres(self):
sleeper_ps_result = self.query('ps', completed=False, active=True).json()
result = self.assertIsResult(sleeper_ps_result)
self.assertEqual(len(result['rows']), 1)
self.assertEqual(len(result['rows'][0]), len(result['columns']))
rowdict = [{k: v for k, v in zip(result['columns'], row)} for row in result['rows']]
rowdict = result['rows']
self.assertEqual(rowdict[0]['request_id'], request_id)
self.assertEqual(rowdict[0]['method'], 'run')
self.assertEqual(rowdict[0]['state'], 'running')
Expand All @@ -706,8 +705,7 @@ def test_ps_kill_postgres(self):
complete_ps_result = self.query('ps', completed=True, active=False).json()
result = self.assertIsResult(complete_ps_result)
self.assertEqual(len(result['rows']), 1)
self.assertEqual(len(result['rows'][0]), len(result['columns']))
rowdict = [{k: v for k, v in zip(result['columns'], row)} for row in result['rows']]
rowdict = result['rows']
self.assertEqual(rowdict[0]['request_id'], 1)
self.assertEqual(rowdict[0]['method'], 'compile')
self.assertEqual(rowdict[0]['state'], 'finished')
Expand All @@ -716,9 +714,7 @@ def test_ps_kill_postgres(self):
all_ps_result = self.query('ps', completed=True, active=True).json()
result = self.assertIsResult(all_ps_result)
self.assertEqual(len(result['rows']), 2)
self.assertEqual(len(result['rows'][0]), len(result['columns']))
self.assertEqual(len(result['rows'][1]), len(result['columns']))
rowdict = [{k: v for k, v in zip(result['columns'], row)} for row in result['rows']]
rowdict = result['rows']
rowdict.sort(key=lambda r: r['start'])
self.assertEqual(rowdict[0]['request_id'], 1)
self.assertEqual(rowdict[0]['method'], 'compile')
Expand Down Expand Up @@ -765,7 +761,7 @@ def _get_sleep_query(self):
time.sleep(0.2)
sleeper_ps_result = self.query('ps', completed=False, active=True).json()
result = self.assertIsResult(sleeper_ps_result)
rows = [{k: v for k, v in zip(result['columns'], row)} for row in result['rows']]
rows = result['rows']
for row in rows:
if row['request_id'] == request_id and row['state'] == 'running':
return pg_sleeper, row['task_id'], request_id
Expand Down

0 comments on commit 2654c79

Please sign in to comment.