aboutsummaryrefslogtreecommitdiff
path: root/bestflags/task.py
diff options
context:
space:
mode:
authorYuheng Long <yuhenglong@google.com>2013-06-03 18:46:00 -0700
committerChromeBot <chrome-bot@google.com>2013-06-10 20:21:38 -0700
commitf20cffac082e3d920818f230ffc80ae6976267c0 (patch)
treed1375d3dd7b0a32be97bd179f8fab7ab3e096473 /bestflags/task.py
parent8cdaddf7ec91520a0bfbdf9da73056f255f67824 (diff)
downloadtoolchain-utils-f20cffac082e3d920818f230ffc80ae6976267c0.tar.gz
Added the skeleton for the flagging framework.
BUG=None TEST=None Change-Id: I72c37ac70ed2adca588ad9866a6bcc26775aed8b Reviewed-on: https://gerrit-int.chromium.org/39096 Reviewed-by: Luis Lozano <llozano@chromium.org> Tested-by: Yuheng Long <yuhenglong@google.com> Commit-Queue: Yuheng Long <yuhenglong@google.com>
Diffstat (limited to 'bestflags/task.py')
-rw-r--r--bestflags/task.py66
1 files changed, 66 insertions, 0 deletions
diff --git a/bestflags/task.py b/bestflags/task.py
new file mode 100644
index 00000000..b092ffc9
--- /dev/null
+++ b/bestflags/task.py
@@ -0,0 +1,66 @@
+"""A reproducing entity.
+
+The Task class is used by different modules. Each module fills in the
+corresponding information into a Task instance. Class Task contains the bit set
+representing the flags selection. The builder module is responsible for filling
+the image and the checksum field of a Task. The executor module will put the
+execution output to the execution field.
+"""
+
+__author__ = 'yuhenglong@google.com (Yuheng Long)'
+
+
+class Task(object):
+ """A single reproducing entity.
+
+ A single test of performance with a particular set of flags. It records the
+ flag set, the image, the check sum of the image and the cost.
+ """
+
+ def __init__(self, flag_set):
+ """Set up the optimization flag selection for this task.
+
+ Args:
+ flag_set: the optimization flag set that is encapsulated by this task.
+ """
+ self._flag_set = flag_set
+
+ def reproduce_with(self, other):
+ """Create a new SolutionCandidate by reproduction with another.
+
+ Mix two Tasks together to form a new Task of the same class. This is one of
+ the core functions of a GA.
+
+ Args:
+ other: The other Task to reproduce with.
+
+ Returns: A Task that is a mix between self and other.
+ """
+ pass
+
+ def compile(self):
+ """Run a compile.
+
+ This method compile an image using the present flags, get the image,
+ test the existent of the image and gathers monitoring information, and sets
+ the internal cost (fitness) for this set of flags.
+ """
+ pass
+
+ def get_flags(self):
+ pass
+
+ def set_flags(self, flags):
+ pass
+
+ def get_checksum(self):
+ pass
+
+ def set_checksum(self, checksum):
+ pass
+
+ def get_image(self):
+ pass
+
+ def set_image(self, image):
+ pass