Skip to content

Commit

Permalink
Scheduling watch paths to run immediately
Browse files Browse the repository at this point in the history
  • Loading branch information
costrouc committed Aug 20, 2021
1 parent 9199fcb commit 994c60a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
10 changes: 4 additions & 6 deletions conda-store-server/conda_store_server/orm.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,7 @@ class CondaChannel(Base):
last_update = Column(DateTime)

def update_packages(self, db):
# TODO: needs to be done within transaction
previous_last_update = self.last_update
self.last_update = datetime.datetime.utcnow()
db.commit()

repodata = download_repodata(self.name, previous_last_update)
repodata = download_repodata(self.name, self.last_update)
if not repodata:
# nothing to update
return
Expand Down Expand Up @@ -237,6 +232,9 @@ def update_packages(self, db):
existing_architecture_sha256.add(package["sha256"])
db.commit()

self.last_update = datetime.datetime.utcnow()
db.commit()


class CondaPackage(Base):
__tablename__ = "conda_package"
Expand Down
11 changes: 7 additions & 4 deletions conda-store-server/conda_store_server/server/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,13 @@ def after_request_function(response):
app.register_blueprint(app_auth, url_prefix=self.url_prefix)

app.conda_store.ensure_namespace()
app.conda_store.ensure_directories()
app.conda_store.configuration.update_storage_metrics(
app.conda_store.db, app.conda_store.store_directory
)
app.conda_store.ensure_conda_channels()

# schedule tasks
app.conda_store.celery_app

from conda_store_server.worker import tasks
(tasks.task_watch_paths.si()).apply_async(countdown=10)
(tasks.task_update_storage_metrics.si()).apply_async(countdown=10)

app.run(debug=True, host=self.address, port=self.port)
5 changes: 5 additions & 0 deletions tests/e2e/cypress/integration/main.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
describe('First Test', () => {
it('Check conda-store home page', () => {
// display home page without login
cy.visit('/conda-store/');

// visit login page
cy.visit('/conda-store/login/')

// click on sign in with jupyterhub
// login through jupyterhub oauth server
cy.get('#login > a')
.should('contain', 'Sign in with JupyterHub')
.click();

// fill in username and password and submit
cy.get('#username_input')
.type('conda-store-test');

Expand Down

0 comments on commit 994c60a

Please sign in to comment.