Commit 67f34f27 authored by André Anjos's avatar André Anjos 💬

[experiments] Re-use is_done() method from experiments

parent e0be6886
......@@ -674,7 +674,7 @@ class Experiment(Shareable):
def reset(self):
"""Resets an experiment so it can be run again"""
if not self.done(): return #can only reset experiments which are done
if not self.is_done(): return #can only reset experiments which are done
......@@ -732,16 +732,10 @@ class Experiment(Shareable):
return storage.get_file_content(self, 'declaration_file')
def done(self):
'''Says whether the experiment has finished or not'''
return self.status in (Experiment.DONE, Experiment.FAILED)
def update_state(self):
'''Update self state based on associated block states'''
if self.done(): return
if self.is_done(): return
block_statuses = self.blocks.values_list('status', flat=True)
......@@ -811,6 +805,17 @@ class Experiment(Shareable):
for b in self.blocks.all(): b._cancel()
def fork(self, username=None, name=None):
'''Forks this experiment under a new username or name'''
author = username or
name = name or
xp, _, __ = Experiment.objects.create_experiment(author,
self.toolchain, name, self.get_declaration(),
self.short_description, self.description)
return xp
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment