-
Notifications
You must be signed in to change notification settings - Fork 34
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
Run refactorization #1286
Run refactorization #1286
Conversation
# Conflicts: # gateway/api/views.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks!
I'm going to wait for your merges @akihikokuroda and wait a bit for @psschwei or @IceKhan13 if they can take a look |
# Conflicts: # gateway/tests/api/test_v1_serializers.py
Looks like docker/kubernetes tests are both failing with the same error in the running_programs_using_decorators notebook:
Does the decorators code need an update? |
I don't see the changes in |
I found a problem with #1285 I'm fixing it now and put here the problem, @akihikokuroda |
Tests passed so here is what I found, @akihikokuroda . With Configuration(workers=None, min_workers=None, max_workers=None, auto_scaling=False, python_version='py39')
Until here everything is fine with the changes from #1285 The problem comes in the <QueryDict: {'title': ['my-first-pattern'], 'entrypoint': ['basic-pattern.py'], 'arguments': ['{"test": "here it goes an argument"}'], 'dependencies': ['[]'], 'config': ['workers', 'min_workers', 'max_workers', 'auto_scaling', 'python_version'], 'artifact': [<InMemoryUploadedFile: artifact.tar ()>]}> I don't know why but Django transforms
What it generates the error. We didn't find this problem basically because we don't have a test for My question now is, with |
I saw Django handled the Content-type and the config field without converting to the string. You may merge this PR as-is. I can try the #1285 later. |
Ok, I'm going to prepare a test for this anyway before merge and put on-hold #1290 until we clarify this. Thanks, Aki. |
Is that configuration part of our code somewhere? (wasn't clear if it was or just an example you made up) If so, do we need to update the python version to py310? |
Oh no, no @psschwei . They're just some examples that I'm doing to test things locally hehe. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a question about names, but otherwise LGTM
""" | ||
Job serializer for the /run_existing end-point | ||
Job serializer for the /run and /run_existing end-point |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
long-term thought: would it make sense to refactor the API to just use a single /run
endpoint and distinguish within the call whether the program/function/pattern/job/building_block/element/quantum_magic has already been uploaded or not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely I think it's something that we can propose. I had in mind to continue the improvements in the gateway from a code organization point of view: #1286 (comment)
I considered too that we could refactor /run
end-point to /upload
+ /run_existing
in the client or something like that. Feel free to open an issue or a discussion because I think it deserves the times the refactorization.
@@ -11,7 +11,6 @@ | |||
from api.models import Program, Job, RuntimeJob | |||
from api.permissions import IsOwner | |||
from . import serializers as v1_serializers | |||
from . import services as v1_services |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is maybe more for a later refactoring (change wasn't introduced in this PR, so let's not change now), but do we call non-v1 serializers here? if not, given that we're already in a v1/
directory the prefix is a little redundant
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, I agree. It could be simplified.
I fixed the problems. Added some tests and ensure that everything is working. I planned to merge at the end of the day if you don't see anything that I should change. Let me know 🙏 |
Summary
Close #1240
This PR continues the work of #1267. The logic is pretty similar the biggest difference is that here we remove
services
references because we are moving all the logic to theserializers
, finally.Details and comments
exceptions
too because they were not working as expected. I will continue this effort as part of Client + gateway: improve error handling #1264