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

Runtimejob API ModelView #1191

Merged
merged 3 commits into from
Jan 29, 2024
Merged

Conversation

akihikokuroda
Copy link
Collaborator

Summary

This PR adds ModelView API for RuntimeJob model

Details and comments

With this, the get, list and delete operations are easy and useful but the create operation is quite difficult to issue. Form the usage of the RuntimeJob view, it may be better to have the following additional API in the Job.

/api/v1/jobs/{job id}/add_runtimejob
and
/api/v1/jobs/{job id}/list_runtimejob

@psschwei
Copy link
Collaborator

@akihikokuroda would adding the additional API change this PR? or would it be done separately?

@akihikokuroda
Copy link
Collaborator Author

@psschwei I'll do it separately.

Copy link
Collaborator

@psschwei psschwei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
I still feel a bit iffy on the django framework, so I'd like either @IceKhan13 or @Tansito to review also

@akihikokuroda
Copy link
Collaborator Author

@psschwei Thanks for review!

RuntimeJob view set first version. Use RuntomeJobSerializer V1.
"""

queryset = RuntimeJob.objects.all()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it will select all runtime jobs, even not authored by user :)


queryset = RuntimeJob.objects.all()
serializer_class = v1_serializers.RuntimeJobSerializer
permission_classes = [permissions.IsAuthenticated]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since IsOwner changed, we can add it now here

return self.serializer_class

def get_queryset(self):
return RuntimeJob.objects.all()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above. We need to select only authored runtime jobs.

Copy link
Member

@IceKhan13 IceKhan13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Couple of tweaks and we are good to go!

@akihikokuroda
Copy link
Collaborator Author

@IceKhan13 Thanks for review. I updated the code and also updated the test to make sure it works.

@akihikokuroda
Copy link
Collaborator Author

@IceKhan13 WDYT about additional APIs

Adding runtime job to the job:

/api/v1/jobs/{job id}/add_runtimejob

list the runtime jobs created in the job:

/api/v1/jobs/{job id}/list_runtimejob

I can create another PR if they are good.

@IceKhan13
Copy link
Member

WDYT about additional APIs

sounds like a good idea! Let's create a separate PR for this APIs

Thank you!

Copy link
Member

@IceKhan13 IceKhan13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Thank you @akihikokuroda !

@akihikokuroda akihikokuroda merged commit 114490a into Qiskit:main Jan 29, 2024
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants