-
Notifications
You must be signed in to change notification settings - Fork 79
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
Allow reindexing on startup #579
Comments
Hey, I was just looking for this too. Did you find something that worked? I made a quick attempt and it seems something like this might work? Update I temporarily create an admin user # add to ~ https://github.com/mamba-org/quetz/blob/main/quetz/main.py#L1724
@app.on_event("startup")
def start_reindex_packages_from_pkg_store():
from .tasks.reindexing import reindex_packages_from_store
db_manager = contextmanager(get_db)
with TicToc("Reindex packages"):
with db_manager(config) as db:
dao = get_dao(db)
admin = dao.create_user_with_role('system', 'admin')
pkg_store = config.get_package_store()
for channel in pkg_store.list_channels():
# loop over all channels found in the pkg store
reindex_packages_from_store(dao, config, channel, user_id=admin.id)
dao.delete_user(admin.id)
# Add to ~ https://github.com/mamba-org/quetz/blob/main/quetz/pkgstores.py#L80
@abc.abstractmethod
def list_channels(self) -> List[str]:
pass
# Azure example: https://github.com/mamba-org/quetz/blob/main/quetz/pkgstores.py#L576
def list_channels(self) -> List[str]:
with self._get_fs() as fs:
for d in fs.ls(self.container_prefix):
if not fs.isdir(d):
continue
yield d.replace(self.container_prefix, "") I also saw that currently the reindexing only works for # https://github.com/mamba-org/quetz/blob/main/quetz/tasks/reindexing.py#L140
pkg_files = [f for f in all_files if f.endswith(".tar.bz2")]
# updated to
pkg_files = [f for f in all_files if f.endswith(".tar.bz2") or f.endswith(".conda")] |
If your
quetz
server is restarted and you're not using an external database you will lose all package information (IIUC).You can manually reindex the server by calling the
/api/channels
endpoint but it might be nice if you could specify a configuration such thatquetz
would automatically reindex all channels it knows about whenever it starts up.The text was updated successfully, but these errors were encountered: