diff --git a/beat/web/experiments/models.py b/beat/web/experiments/models.py index 4e086ef8726094c148180f669127a8c8a5905027..3cd92a8078ea4694f635a427ff701535f2dbc0a3 100644 --- a/beat/web/experiments/models.py +++ b/beat/web/experiments/models.py @@ -599,6 +599,13 @@ class Experiment(Shareable): def core(self): 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): return reverse( 'experiments:view', @@ -1127,14 +1134,19 @@ class CachedFile(models.Model): def path(self): '''Returns the full path prefix to the cached file on disk''' - return os.path.join(settings.CACHE_ROOT, - beat.core.hash.toPath(self.hash, suffix='')) + return 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): '''Returns a list of files matching this cache prefix path''' - return glob.glob(self.path() + '*') + return glob.glob(self.absolute_path() + '*') def exists(self):