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

🎨 Add payment headers to start job #4892

Merged

Conversation

bisgaard-itis
Copy link
Contributor

@bisgaard-itis bisgaard-itis commented Oct 20, 2023

What do these changes do?

  • Add the possibility to add a pricing-plan-id and pricing-unit-id when starting a job via the api server. This is done by passing headers x-pricing-plan and x-pricing-unit.
  • These are not required to start a job. Hence, I am relying on the assumption that, if a pricing plan and unit are required for a job to run, then this will be checked elsewhere and the job/project will fail if these are not passed.
  • I also refactored services/api-server/src/simcore_service_api_server/api/routes/solvers_jobs.py to make the automatic code checkers happy

Related issue/s

How to test

I added unit tests to the API server unittest suite. So they will run automatically in the github workflow

DevOps Checklist

@bisgaard-itis bisgaard-itis added a:apiserver api-server service a:payments payments service labels Oct 20, 2023
@bisgaard-itis bisgaard-itis added this to the Microhistory milestone Oct 20, 2023
@bisgaard-itis bisgaard-itis self-assigned this Oct 20, 2023
@bisgaard-itis bisgaard-itis requested a review from mguidon October 20, 2023 08:30
@bisgaard-itis
Copy link
Contributor Author

bisgaard-itis commented Oct 20, 2023

requesting a review from you @mguidon so you can see the mechanism you will need to use from S4L and have a chance to make comments before it goes in.

@bisgaard-itis
Copy link
Contributor Author

@pcrespov if you have a look at this, maybe think about if something needs to be done concerning products in this PR. I don't yet understand how that will fit into the picture...

@codecov
Copy link

codecov bot commented Oct 20, 2023

Codecov Report

❗ No coverage uploaded for pull request base (master@c751b1d). Click here to learn what that means.
The diff coverage is 69.3%.

❗ Current head 9ebb7c0 differs from pull request most recent head dad8043. Consider uploading reports for the commit dad8043 to get more accurate results

Impacted file tree graph

@@           Coverage Diff            @@
##             master   #4892   +/-   ##
========================================
  Coverage          ?   66.6%           
========================================
  Files             ?     576           
  Lines             ?   28323           
  Branches          ?     195           
========================================
  Hits              ?   18869           
  Misses            ?    9405           
  Partials          ?      49           
Flag Coverage Δ
integrationtests 65.1% <ø> (?)
unittests 82.1% <69.3%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
...-server/src/simcore_service_api_server/api/root.py 100.0% <100.0%> (ø)
...core_service_api_server/api/routes/solvers_jobs.py 85.5% <100.0%> (ø)
.../simcore_service_api_server/models/schemas/jobs.py 96.1% <100.0%> (ø)
...c/simcore_service_api_server/services/webserver.py 89.7% <100.0%> (ø)
...ore_service_api_server/utils/http_calls_capture.py 87.5% <50.0%> (ø)
...rc/simcore_service_api_server/utils/client_base.py 86.4% <50.0%> (ø)
..._api_server/utils/http_calls_capture_processing.py 78.9% <25.0%> (ø)
...vice_api_server/api/routes/solvers_jobs_getters.py 79.6% <79.6%> (ø)
...imcore_service_api_server/utils/client_base_dev.py 0.0% <0.0%> (ø)

Copy link
Member

@pcrespov pcrespov left a comment

Choose a reason for hiding this comment

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

Great job! I added some suggestions!

@pcrespov
Copy link
Member

@pcrespov if you have a look at this, maybe think about if something needs to be done concerning products in this PR. I don't yet understand how that will fit into the picture...

@bisgaard-itis see my comments and the issue I refer above.The permissions to access those price lists are attached to the project. The webserver is the responsible for access-rights. When the api-server knows about the product, the request to the webserver should resolve permissions to those.

@bisgaard-itis
Copy link
Contributor Author

@pcrespov if you have a look at this, maybe think about if something needs to be done concerning products in this PR. I don't yet understand how that will fit into the picture...

@bisgaard-itis see my comments and the issue I refer above.The permissions to access those price lists are attached to the project. The webserver is the responsible for access-rights. When the api-server knows about the product, the request to the webserver should resolve permissions to those.

Sounds good. Thanks

Copy link
Member

@pcrespov pcrespov left a comment

Choose a reason for hiding this comment

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

please solve as well the 3 code smells that sonarcloud is spotting. thx

@bisgaard-itis bisgaard-itis enabled auto-merge (squash) October 23, 2023 08:20
@bisgaard-itis
Copy link
Contributor Author

@mrnicegyu11 @YuryHrytsuk could I get one of you to take a look at this. I think I need one of your approvals. Probably because I changed an environment variable. This is only related to the dev environment and only for the api server

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@codeclimate
Copy link

codeclimate bot commented Oct 24, 2023

Code Climate has analyzed commit dad8043 and detected 0 issues on this pull request.

View more on Code Climate.

@pcrespov pcrespov disabled auto-merge October 24, 2023 13:48
@pcrespov pcrespov merged commit 8c728c8 into ITISFoundation:master Oct 24, 2023
@bisgaard-itis bisgaard-itis deleted the add-payment-headers-to-start-job branch October 25, 2023 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:apiserver api-server service a:payments payments service
Projects
None yet
Development

Successfully merging this pull request may close these issues.

API: access to wallets/payment for job submission
4 participants