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

GSYE-803: Add set_live_generation to RestAssetClient #244

Merged
merged 1 commit into from
Oct 30, 2024

Conversation

hannesdiedrich
Copy link
Member

Reason for the proposed changes

Please describe what we want to achieve and why.

Proposed changes

INTEGRATION_TESTS_BRANCH=master

GSY_E_TARGET_BRANCH=master

GSY_FRAMEWORK_BRANCH=master

@hannesdiedrich hannesdiedrich requested a review from a team October 25, 2024 10:15
Copy link
Member

@spyrostz spyrostz left a comment

Choose a reason for hiding this comment

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

LGTM

def set_live_generation(self, live_data: Dict, do_not_wait=False):
"""Send live generation data to gsy-web."""
transaction_id, posted = self._post_request(f"{self.endpoint_prefix}/set-live-generation",
{"live_data": live_data})
Copy link

Choose a reason for hiding this comment

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

Doesn't the endpoint only accept config_uuid and area_uuid as per
set_live_generation(request, config_uuid, area_uuid):
What is the relationship between live_data and these?

Copy link
Member Author

Choose a reason for hiding this comment

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

I did not study informatics, so my following explanation might not use the correct nomenclature, but let me try to explain anyway:
There are two streams for data in a REST API: The parameters and the body. The parameters are put in the URL of the request and any additional data can be put in the body.
So for this specific API endpoint a valid URL looks like:

http://localhost:8000/external-connection/api/cc3251d1-320e-4158-818f-e2e49b2bfc04/d1013b2f-bc07-403b-b61e-5f593cb0e749/set-live-generation/

That contains the config_uuid and the area_uuid. The actual data is sent in the body, that is represented by the request.data in the endpoint implementation here:
https://github.com/gridsingularity/gsy-web/pull/2198/files#diff-50bbb55953ee93d276958a5a67f62263471aba048061dfedd78ef488f513988aR92

The additional data is a dictionary that looks like:

{"live_data":"20240101T00:00"}

@spyrostz spyrostz merged commit 6cbac39 into master Oct 30, 2024
1 check passed
@spyrostz spyrostz deleted the feature/GSYE-803 branch October 30, 2024 21:17
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