Skip to content

Commit

Permalink
Merge pull request #31 from aclowes/ordering
Browse files Browse the repository at this point in the history
fix missing task state and execution ordering
  • Loading branch information
aclowes authored May 5, 2018
2 parents bf68cde + d87dced commit 0f10d4b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
1 change: 1 addition & 0 deletions frontend/src/WorkflowDetailHistory.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export default class WorkflowDetailHistory extends React.Component {
running: 'console',
succeeded: 'ok',
failed: 'remove',
upstream_failed: 'minus',
};

loadRuns(workflow_id) {
Expand Down
7 changes: 7 additions & 0 deletions frontend/src/tests/__snapshots__/WorkflowDetail.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,13 @@ exports[`WorkflowDetail success 1`] = `
:
failed
</td>
<td>
<span
className="upstream_failed glyphicon glyphicon-minus"
/>
:
upstream_failed
</td>
</tr>
</tbody>
</table>
Expand Down
6 changes: 5 additions & 1 deletion yawn/task/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def get_minutes_running(self, obj):


class TaskDetailSerializer(TaskSerializer):
executions = ExecutionDetailSerializer(many=True, source='execution_set', read_only=True)
executions = serializers.SerializerMethodField()
messages = MessageSerializer(many=True, source='message_set', read_only=True)

max_retries = serializers.IntegerField(source='template.max_retries')
Expand All @@ -57,6 +57,10 @@ class TaskDetailSerializer(TaskSerializer):
terminate = serializers.IntegerField(write_only=True)
enqueue = serializers.BooleanField(write_only=True)

def get_executions(self, instance):
executions = instance.execution_set.order_by('id')
return ExecutionDetailSerializer(executions, many=True).data

def update(self, instance, validated_data):
if validated_data.get('terminate'):
instance.execution_set.filter(
Expand Down
7 changes: 4 additions & 3 deletions yawn/task/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ def get_queryset(self):
Optionally filter to the executions for a given worker
"""
queryset = self.queryset
worker = self.request.query_params.get('worker', None)
worker = self.request.query_params.get('worker')
if worker is not None:
queryset = queryset.filter(worker_id=worker)
return queryset.order_by('-id')
# worker page filters and reverses the order
queryset = queryset.filter(worker_id=worker).order_by('-id')
return queryset

0 comments on commit 0f10d4b

Please sign in to comment.