-
Notifications
You must be signed in to change notification settings - Fork 30
✨ Personalized resource limits: add API to change node resources ⚠️🗃️ #4374
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
Merged
sanderegg
merged 73 commits into
ITISFoundation:master
from
sanderegg:personalized-resource-limits/keep-selected-resources-in-projects-nodes
Jun 23, 2023
Merged
Changes from all commits
Commits
Show all changes
73 commits
Select commit
Hold shift + click to select a range
b7cf0d4
add first integration
sanderegg 88fd5fb
create and delete project nodes with default resources
sanderegg e00fac2
let users do stupid things
sanderegg abe591e
copy works
sanderegg 339ef41
computation now works as well
sanderegg 92eba71
reserved for TESTER
sanderegg 97fdccd
wrap old way with new way
sanderegg 4903102
small refactor
sanderegg 182319e
cleanup
sanderegg b418544
small refactor
sanderegg d048411
add aiopg fixture
sanderegg d666542
revert
sanderegg 9d4f8e5
cleanup
sanderegg 64b39ed
hit a wall. node id are not unique!!
sanderegg a94b8aa
fix typo
sanderegg 37732ad
multiple insertion
sanderegg bc91b49
use new syntax
sanderegg fe901a1
only add if necessary
sanderegg dbe035b
simplify syntax
sanderegg 73aa8c5
refactor
sanderegg 40ae223
add more clients
sanderegg 8fb9799
clean and reduce test expectations
sanderegg 4288087
improve a bit
sanderegg f70e04d
ensure we clenaup
sanderegg d8f6d93
optimize and fix code
sanderegg 406e9a3
ensure the test runs
sanderegg 778fc64
cleanup
sanderegg 2e6d3df
make cleaning more efficient, remove stupid tests
sanderegg 1807869
all good
sanderegg daa94de
sql 2.0
sanderegg 73dbc73
improve copying
sanderegg 7b2e029
change syntax
sanderegg 1a1f490
const utils
sanderegg 13b14ca
create better fake
sanderegg 7bcd117
faster testing
sanderegg 1fe9c8a
add function to list project nodes
sanderegg b25a132
fix copying
sanderegg 3970956
use a different example
sanderegg 5842790
fix function
sanderegg f88ab64
typing
sanderegg 137a328
fixed test
sanderegg 039ab3f
refactor
sanderegg 33cf79d
adapt to async version of entries.
sanderegg 6fc5f9b
types
sanderegg e92ca56
make postgres-database tests fail on sql2.0 warnings
sanderegg 1358c8c
also accepts dictionaries
sanderegg e9480c3
cleanup
sanderegg 4f732df
added exception for invalid node resources
sanderegg 1a0fb68
add test on _nodes_resources
sanderegg 9234dac
cleanup
sanderegg b5fa83a
fix insertion with None
sanderegg de12fe5
remove warning (confirmed by @pcrespov)
sanderegg 4cf4628
enhance testing
sanderegg 7377c27
cleanup
sanderegg 9ff8914
cleanup and further test coverage
sanderegg 2ffff36
cleanup
sanderegg acb71f4
add docs
sanderegg de33452
reduce cognitivity levels
sanderegg fb85b70
ensure defaults are returned in case no value was set
sanderegg 36e4669
rename
sanderegg 01a6f17
failing test
sanderegg 6504828
refactor and ensure default values are gotten
sanderegg 19ca28a
check computation gets resources correctly
sanderegg 35a58dd
add migration of projects data
sanderegg c7c3f4e
removed code to duplicate
sanderegg 9c2acdc
@pcrespov review: get_field_names more readable
sanderegg c472d0d
@pcrespov review: use columns
sanderegg 1b648bf
@pcrespov review: add mixin with from_row function to create from aiopg
sanderegg bb8c8a9
@pcrespov review: change name of module
sanderegg 1188264
@pcrespov review: use columns
sanderegg 96afb1f
@pcrespov review: remove comment
sanderegg ed4f58d
@GitHK review: confusing uuidlib
sanderegg 0f80be1
@pcrespov review: dict alias
sanderegg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
...ore_postgres_database/migration/versions/add0afaaf728_migrate_projects_workbench_step1.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
"""migrate projects workbench step1 | ||
|
||
Revision ID: add0afaaf728 | ||
Revises: 6e91067932f2 | ||
Create Date: 2023-06-22 14:45:38.827559+00:00 | ||
|
||
""" | ||
import sqlalchemy as sa | ||
from alembic import op | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "add0afaaf728" | ||
down_revision = "6e91067932f2" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
projects_table = sa.table( | ||
"projects", | ||
sa.column("uuid"), | ||
sa.column("workbench"), | ||
sa.column("creation_date"), | ||
sa.column("last_change_date"), | ||
) | ||
projects_nodes_table = sa.table( | ||
"projects_nodes", | ||
sa.column("project_uuid"), | ||
sa.column("node_id"), | ||
sa.column("created"), | ||
sa.column("modified"), | ||
) | ||
|
||
connection = op.get_bind() | ||
|
||
for project_uuid, workbench, creation_date, last_change_date in connection.execute( | ||
projects_table.select() | ||
): | ||
for node_id in workbench.keys(): | ||
connection.execute( | ||
projects_nodes_table.insert().values( | ||
sanderegg marked this conversation as resolved.
Show resolved
Hide resolved
|
||
project_uuid=project_uuid, | ||
node_id=node_id, | ||
created=creation_date, | ||
modified=last_change_date, | ||
) | ||
) | ||
|
||
|
||
def downgrade(): | ||
projects_nodes_table = sa.table( | ||
"projects_nodes", | ||
sa.column("project_uuid"), | ||
sa.column("node_id"), | ||
) | ||
connection = op.get_bind() | ||
|
||
connection.execute(projects_nodes_table.delete()) |
13 changes: 13 additions & 0 deletions
13
packages/postgres-database/src/simcore_postgres_database/utils_models.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from typing import TypeVar | ||
|
||
from aiopg.sa.result import RowProxy | ||
|
||
ModelType = TypeVar("ModelType") | ||
|
||
|
||
class FromRowMixin: | ||
"""Mixin to allow instance construction from aiopg.sa.result.RowProxy""" | ||
|
||
@classmethod | ||
def from_row(cls: type[ModelType], row: RowProxy) -> ModelType: | ||
return cls(**dict(row.items())) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.