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

feat(models): add service tables #241

Merged
merged 2 commits into from
Jan 20, 2025
Merged

Conversation

Alputer
Copy link
Member

@Alputer Alputer commented Nov 20, 2024

This PR adds Service table to db. Currently, we have only dask service but it is a generic implementation and can be used for other components associated with workflows in the future.

@Alputer Alputer self-assigned this Nov 20, 2024
Copy link

codecov bot commented Nov 20, 2024

Codecov Report

Attention: Patch coverage is 90.32258% with 3 lines in your changes missing coverage. Please review.

Project coverage is 72.79%. Comparing base (a599583) to head (f0da4c1).
Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
reana_db/models.py 93.33% 2 Missing ⚠️
reana_db/version.py 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #241      +/-   ##
==========================================
+ Coverage   72.14%   72.79%   +0.64%     
==========================================
  Files           7        7              
  Lines         955      985      +30     
==========================================
+ Hits          689      717      +28     
- Misses        266      268       +2     
Files with missing lines Coverage Δ
reana_db/version.py 0.00% <0.00%> (ø)
reana_db/models.py 90.59% <93.33%> (+0.15%) ⬆️

Alputer added a commit to Alputer/reana-db that referenced this pull request Nov 20, 2024
Alputer added a commit to Alputer/reana-db that referenced this pull request Jan 16, 2025
Revision ID: 8da6ccf08af9
Revises: 2e82f33ee37d
Create Date: 2024-11-19 10:51:51.199670

Copy link
Member

Choose a reason for hiding this comment

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

todo: ‏Remove empty line in the docstring.

Copy link
Member Author

Choose a reason for hiding this comment

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

All other files (except workflow_sharing migration which has the additional rebase_date field) have the same format. Maybe better to follow the same structure? The empty line might be signaling that no rebasing has taken place.

sa.PrimaryKeyConstraint("service_id", name=op.f("pk_workflow_service")),
schema="__reana",
)
# ### end Alembic commands ###
Copy link
Member

Choose a reason for hiding this comment

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

todo: ‏Remove the "end Alembic" comment.

"""Downgrade to 2e82f33ee37d revision."""
op.drop_table("workflow_service", schema="__reana")
op.drop_table("service", schema="__reana")
# ### end Alembic commands ###
Copy link
Member

Choose a reason for hiding this comment

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

todo: ‏Remove "end Alembic" comment.

class ServiceType(enum.Enum):
"""Enumeration of service types."""

dask = 0
Copy link
Member

Choose a reason for hiding this comment

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

Is this one intended to be general Dask service? I wonder about distinguishing Dask cluster from Dask dashboard, for example in case there would be more services exposed from the Dask integration. But I guess these theoretical distinctions may not be useful as of yet...

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 think we can introduce a new service type relatively easily if we need an extra field in the future. Calling the service dask_dashboard or something similar at the moment could be too specific.

id_ = Column(UUIDType, primary_key=True, default=generate_uuid)
name = Column(String(255))
uri = Column(Text) # uri to access the service
status = Column(Enum(RunStatus), nullable=False, default=RunStatus.created)
Copy link
Member

Choose a reason for hiding this comment

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

For admin use cases, it may be perhaps good to have some indexes, e.g. on the status column so that we could ask "which users have Dask dashboards still open?". But this is something that we may also get to later.

Alputer added a commit to Alputer/reana-db that referenced this pull request Jan 16, 2025
Alputer added a commit to Alputer/reana-db that referenced this pull request Jan 16, 2025
Alputer added a commit to Alputer/reana-db that referenced this pull request Jan 17, 2025
Alputer added a commit to Alputer/reana-db that referenced this pull request Jan 17, 2025
Alputer added a commit to Alputer/reana-db that referenced this pull request Jan 17, 2025
@mdonadoni mdonadoni removed their request for review January 17, 2025 10:33
@tiborsimko tiborsimko merged commit f0da4c1 into reanahub:master Jan 20, 2025
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants