Skip to content

Commit 4135bcc

Browse files
committed
Update build with "Pulling cache" when downloading the cache
1 parent b5bb99c commit 4135bcc

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

readthedocs/builds/constants.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@
55

66

77
BUILD_STATE_TRIGGERED = 'triggered'
8+
BUILD_STATE_PULLING_CACHE = 'pulling-cache'
89
BUILD_STATE_CLONING = 'cloning'
910
BUILD_STATE_INSTALLING = 'installing'
1011
BUILD_STATE_BUILDING = 'building'
1112
BUILD_STATE_FINISHED = 'finished'
1213

1314
BUILD_STATE = (
1415
(BUILD_STATE_TRIGGERED, _('Triggered')),
16+
(BUILD_STATE_PULLING_CACHE, _('Pulling cache')),
1517
(BUILD_STATE_CLONING, _('Cloning')),
1618
(BUILD_STATE_INSTALLING, _('Installing')),
1719
(BUILD_STATE_BUILDING, _('Building')),

readthedocs/projects/tasks.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
BUILD_STATE_CLONING,
3434
BUILD_STATE_FINISHED,
3535
BUILD_STATE_INSTALLING,
36+
BUILD_STATE_PULLING_CACHE,
3637
BUILD_STATUS_SUCCESS,
3738
BUILD_STATUS_FAILURE,
3839
LATEST,
@@ -93,10 +94,12 @@ class CachedEnvironmentMixin:
9394

9495
"""Mixin that pull/push cached environment to storage."""
9596

96-
def pull_cached_environment(self):
97+
def pull_cached_environment(self, environment):
9798
if not self.project.has_feature(feature_id=Feature.CACHED_ENVIRONMENT):
9899
return
99100

101+
environment.update_build(state=BUILD_STATE_PULLING_CACHE)
102+
100103
storage = get_storage_class(settings.RTD_BUILD_ENVIRONMENT_STORAGE)()
101104
filename = self.version.get_storage_environment_cache_path()
102105

@@ -370,7 +373,7 @@ def run(self, version_pk): # pylint: disable=arguments-differ
370373
# repository in this step, and pushing it back will delete
371374
# all the other cached things (Python packages, Sphinx,
372375
# virtualenv, etc)
373-
self.pull_cached_environment()
376+
self.pull_cached_environment(environment)
374377
self.sync_repo(environment)
375378
return True
376379
except RepositoryError:
@@ -594,7 +597,7 @@ def run_setup(self, record=True):
594597
raise ProjectBuildsSkippedError
595598
try:
596599
with self.project.repo_nonblockinglock(version=self.version):
597-
self.pull_cached_environment()
600+
self.pull_cached_environment(environment)
598601
self.setup_vcs(environment)
599602
except vcs_support_utils.LockTimeout as e:
600603
self.task.retry(exc=e, throw=False)

0 commit comments

Comments
 (0)