Skip to content
Snippets Groups Projects
Commit 94e56b5d authored by André Anjos's avatar André Anjos :speech_balloon:
Browse files

[experiments] Add function to return relative paths to caches

parent f6bba0c8
No related branches found
No related tags found
1 merge request!194Scheduler
...@@ -599,6 +599,13 @@ class Experiment(Shareable): ...@@ -599,6 +599,13 @@ class Experiment(Shareable):
def core(self): def core(self):
return validate_experiment(self.declaration, self.toolchain.declaration)[0] return validate_experiment(self.declaration, self.toolchain.declaration)[0]
def job_splits(self, status=None):
from ..backend.models import JobSplit
retval = JobSplit.objects.filter(job__block__in=self.blocks)
if state is not None:
retval = retval.filter(status=status)
return retval
def get_absolute_url(self): def get_absolute_url(self):
return reverse( return reverse(
'experiments:view', 'experiments:view',
...@@ -1127,14 +1134,19 @@ class CachedFile(models.Model): ...@@ -1127,14 +1134,19 @@ class CachedFile(models.Model):
def path(self): def path(self):
'''Returns the full path prefix to the cached file on disk''' '''Returns the full path prefix to the cached file on disk'''
return os.path.join(settings.CACHE_ROOT, return beat.core.hash.toPath(self.hash, suffix='')
beat.core.hash.toPath(self.hash, suffix=''))
def absolute_path(self):
'''Returns the full path prefix to the cached file on disk'''
return os.path.join(settings.CACHE_ROOT, self.relative_path())
def files(self): def files(self):
'''Returns a list of files matching this cache prefix path''' '''Returns a list of files matching this cache prefix path'''
return glob.glob(self.path() + '*') return glob.glob(self.absolute_path() + '*')
def exists(self): def exists(self):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment