Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

We follow the CalVer (https://calver.org/) versioning scheme: YY.MINOR.MICRO.

26.10.1 (2026-05-22)
====================

- Hotfix to resume (rather than restart) a long task after connection error

26.10.0 (2026-05-19)
===================

Expand Down
47 changes: 33 additions & 14 deletions osf/management/commands/migrate_osfmetrics_6to8.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from psycopg2 import OperationalError as PostgresOperationalError

from framework.celery_tasks import app as celery_app
from framework.sentry import log_exception
from osf.metadata.rdfutils import OSF
from osf.metadata.osfmap_utils import is_osf_component
from osf.metrics.preprint_metrics import (
Expand Down Expand Up @@ -72,13 +73,14 @@
RegistriesModerationMetrics: es8_metrics.RegistriesModerationEventEs8,
}

_RETRY_ERRORS = (
DjangoOperationalError,
Elastic6ConnectionError,
Elastic8TransportError,
PostgresOperationalError,
)
_TASK_KWARGS = dict(
autoretry_for=(
DjangoOperationalError,
Elastic6ConnectionError,
Elastic8TransportError,
PostgresOperationalError,
),
autoretry_for=_RETRY_ERRORS,
retry_backoff=True, # exponential backoff, with jitter
max_retries=20,
)
Expand Down Expand Up @@ -145,14 +147,31 @@ def migrate_preprint_downloads(from_when: str, until_when: str):


@celery_app.task(**_TASK_KWARGS)
def schedule_migrate_usage_reports(until_when: str):
for _osfid in _merge_sorted_osfids(
_each_usage_report_osfid(until_when=until_when),
_each_countedusage_osfid(until_when=until_when),
_each_preprintview_osfid(until_when=until_when),
_each_preprintdownload_osfid(until_when=until_when),
):
migrate_usage_reports.delay(_osfid, until_when)
def schedule_migrate_usage_reports(until_when: str, after_osfid: str | None = None):
_last_osfid = None
try:
for _osfid in _merge_sorted_osfids(
_each_usage_report_osfid(until_when, after_osfid),
_each_countedusage_osfid(until_when, after_osfid),
_each_preprintview_osfid(until_when, after_osfid),
_each_preprintdownload_osfid(until_when, after_osfid),
):
migrate_usage_reports.delay(_osfid, until_when)
_last_osfid = _osfid
except _RETRY_ERRORS as _error:
if _last_osfid is None:
raise # didn't even get started
# schedule another task to continue scheduling
schedule_migrate_usage_reports.delay(
until_when,
after_osfid=( # avoid infinite loop from _merge_sorted_osfids removing "_v1"
f'{_last_osfid}_v1'
if '_' not in _last_osfid
else _last_osfid
),
)
# let this task succeed but log the error
log_exception(_error)


@celery_app.task(**_TASK_KWARGS)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "OSF",
"version": "26.10.0",
"version": "26.10.1",
"description": "Facilitating Open Science",
"repository": "https://github.com/CenterForOpenScience/osf.io",
"author": "Center for Open Science",
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "osf-io"
version = "26.10.0"
version = "26.10.1"
description = "The code for [https://osf.io](https://osf.io)."
authors = ["Your Name <you@example.com>"]
license = "Apache License 2.0"
Expand Down
Loading