-
Notifications
You must be signed in to change notification settings - Fork 192
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: Repository methods for repo CLI and other features #5156
ADD: Repository methods for repo CLI and other features #5156
Conversation
Created from #4965, @chrisjsewell I modified the type returned so let me know if this now works for you too or there is something else that would need adapting. In the meantime I'll try to add a couple of tests for these new features. |
Codecov Report
@@ Coverage Diff @@
## develop #5156 +/- ##
===========================================
+ Coverage 80.91% 80.93% +0.02%
===========================================
Files 536 536
Lines 37019 37056 +37
===========================================
+ Hits 29952 29987 +35
- Misses 7067 7069 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Yep cheers, another thing from #5145 is that I think there should be a for the @property
def key_format(self):
return self.container.hash_type and for @property
def key_format(self):
return 'uuid4' The reason this is necessary is that, when migrating between backends (e.g. archive -> main), one needs to know if the |
FYI, another thing I want to do, is to move |
aiida/repository/backend/abstract.py
Outdated
|
||
@abc.abstractmethod | ||
def list_objects(self) -> Iterable[str]: | ||
"""Return iterable that yeilds all available objects by key. |
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.
"""Return iterable that yeilds all available objects by key. | |
"""Return iterable that yields all available objects by key. |
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.
If you use VS Code, I certainly recommend https://marketplace.visualstudio.com/items?itemName=streetsidesoftware.code-spell-checker 😉
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.
If I'm developing inside a docker container, will this extension automatically install inside of it when I attach through the remote explorer or will I have to manually re-install it every time I shutdown and re-start the container?
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 know with the new vs code devcontainers, you can specify which extensions to load, see e.g. https://github.com/chrisjsewell/aiida-install/blob/56fe6d7398594c8813890652af99c521a77f249c/.devcontainer/devcontainer.json#L41
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.
When you are using these you need to create the container through the vscode right? I'm not sure this would work for me because I need to initialize mine using docker-compose (I have 3 containers running for this: rabbitmq, postgres, and the work container).
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 was actually playing around with that a bit but found, at least on my macbook, it was a bit slow a prone to the container dying:
.devcontainer/devcontainer.json
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.187.0/containers/docker-existing-dockerfile
// https://github.com/microsoft/vscode-dev-containers/tree/main/containers/python-3-postgres
{
"name": "AiiDA development environment",
"dockerComposeFile": "docker-compose.yml",
"service": "main",
"workspaceFolder": "/workspace",
// Set *default* container specific settings.json values on container create.
"settings": {
"editor.rulers": [100],
"python.pythonPath": "/usr/local/bin/python",
"python.defaultInterpreterPath": "/usr/local/bin/python",
"python.languageServer": "Pylance",
"python.linting.enabled": true,
"python.linting.pylintEnabled": true,
"python.linting.pylintPath": "/usr/local/py-utils/bin/pylint",
"python.formatting.provider": "yapf",
"python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf",
},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"ms-python.python",
"ms-python.vscode-pylance",
"ms-azuretools.vscode-docker",
"streetsidesoftware.code-spell-checker",
"chrisjsewell.aiida-explore-vscode"
],
}
.devcontainer/docker-compose.yml
version: '3.4'
services:
main:
image: 'mcr.microsoft.com/vscode/devcontainers/python:3.8'
volumes:
- ..:/workspace:cached
# Overrides default command so things don't shut down after the process ends.
command: sleep infinity
postgres:
image: postgres:12.3
environment:
POSTGRES_USER: pguser
POSTGRES_PASSWORD: password
restart: unless-stopped
rmq:
image: rabbitmq:3.8.3-management
environment:
RABBITMQ_DEFAULT_USER: guest
RABBITMQ_DEFAULT_PASS: guest
restart: unless-stopped
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.
Uhm, very interesting! Thanks, I will give this a try =D
* Added has_objects as new abstract and apted has_object * Added delete_objects as new abstract and adapted delete_object * Added list_objects method * While modifying the inherited classes I removed some of the docstrings since these should be anyways inherited from the parent class and were just adding visual noise and maintainance costs.
for more information, see https://pre-commit.ci
Co-authored-by: Chris Sewell <chrisj_sewell@hotmail.com>
49ab7eb
to
c2c64b1
Compare
I added the tests I could think of so this is now ready for another round of review. I also added the |
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.
All good thanks @ramirezfranciscof 👌
This is essentially an addition to aiidateam#5156 and required aiidateam#5145 Without the "optimised" use of `Container.get_objects_stream_and_meta` for the `DiskObjectStoreRepositoryBackend`, the profiled archive creation in aiidateam#5145 goes from 4 minutes to 9 minutes!
Methods added and modifications:
since these should be anyways inherited from the parent class and were
just adding visual noise and maintenance costs.