Skip to content

Commit

Permalink
add allowed_dataset_choice in rerun valid api
Browse files Browse the repository at this point in the history
  • Loading branch information
raylrui committed Dec 11, 2024
1 parent 4bf33f1 commit c4c58ff
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class AllowedRerunWorkflow(StrEnum):

class AllowedRerunWorkflowSerializer(serializers.Serializer):
is_valid = serializers.BooleanField()
allowed_dataset_choice = serializers.ListField(child=serializers.CharField())
valid_workflows = serializers.ListField(child=serializers.CharField())

class BaseRerunInputSerializer(serializers.Serializer):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,18 @@ class WorkflowRunActionViewSet(ViewSet):
def validate_rerun_workflows(self, request, *args, **kwargs):
wfl_run = get_object_or_404(self.queryset, pk=kwargs.get('pk'))
is_valid = wfl_run.workflow.workflow_name in AllowedRerunWorkflow

# Get allowed dataset choice for the workflow
wfl_name = wfl_run.workflow.workflow_name
allowed_dataset_choice = []
if wfl_name == AllowedRerunWorkflow.RNASUM.value:
allowed_dataset_choice = RERUN_INPUT_SERIALIZERS[wfl_name].allowed_dataset_choice

reponse = {
'is_valid': is_valid,
'valid_workflows': AllowedRerunWorkflow
'allowed_dataset_choice': allowed_dataset_choice,
'valid_workflows': AllowedRerunWorkflow,

}
return Response(reponse, status=status.HTTP_200_OK)

Expand Down

0 comments on commit c4c58ff

Please sign in to comment.