Example #1
0
def read_outcomes(outcomes_filename):
    result = list()
    file = open(outcomes_filename, 'r')
    cvs_reader = csv.reader(file, delimiter=',')
    for row in cvs_reader:
        id, timestamp = row
        result.append(Outcome(int(id), float(timestamp)))
    return result
Example #2
0
 def run(self):
     args = self.setting.args.split()
     start = time.time()
     if self.setting.extension == 'java':
         cmd = ['java', '-cp', self.setting.path, self.setting.filename]
     elif self.setting.extension == 'c':
         cmd = [self.setting.path, '/', self.setting.filename]
     else:
         raise ValueError('Wrong extenstion')
     cmd.extend(args)
     proc = subprocess.Popen(cmd,
                             stdin=subprocess.PIPE,
                             stdout=subprocess.PIPE,
                             stderr=subprocess.STDOUT)
     stdout, stderr = proc.communicate(self.setting.stdin.encode())
     print(stdout.decode())
     end = time.time() - start
     if self.setting.s_timestapm == '1':
         service = Outcome(self.setting.version, self.setting.name,
                           self.setting.args, self.setting.threads,
                           self.setting.stdin, end, self.setting.iterations)
         writer.write_service(self.output_file, service)
Example #3
0
    def run(self):
        args = self.setting.args.split()
        stdin = '\n'.join(self.setting.stdin.split("@@@"))

        if self.setting.extension == 'class':
            cmd = ['java', '-cp', self.setting.path, self.setting.filename]
        elif self.setting.extension == '' or self.setting.extension == 'exe':
            cmd = [self.setting.path, '/', self.setting.filename]
        else:
            raise ValueError('Wrong extenstion')
        cmd.extend(args)
        start = time.time()
        proc = subprocess.Popen(cmd,
                                stdin=subprocess.PIPE,
                                stdout=subprocess.PIPE,
                                stderr=subprocess.STDOUT)
        stdout, stderr = proc.communicate(stdin.encode())
        print(stdout.decode())
        end = time.time() - start
        if self.setting.s_timestamp:
            outcome = Outcome(self.setting.id, end)
            writer.write_outcome(self.output_file, outcome)
Example #4
0
from model.group import Group
from model.outcome import Outcome

o0 = Outcome(0, 0.1230)
o1 = Outcome(0, 0.113)
o2 = Outcome(0, 0.3230)

o00 = Outcome(1, 0.1230)
o01 = Outcome(1, 0.113)
o02 = Outcome(1, 0.3230)

outcomes = [o0, o1, o2, o00, o01, o02]

groups = Group.get_groups(outcomes)
if len(groups) == 2:
    print('ok')

print(str(Group.random_color()))
print(str(Group.random_color()))
print(str(Group.random_color()))

groups.append(Group(2, outcomes, [255, 255, 255], True, False))

for group in groups:
    print(group.to_string())
Example #5
0
from model.outcome import Outcome

o0 = Outcome(0, 0.1230)
o1 = Outcome(1, 0.113)
o2 = Outcome(2, 0.3230)

print(o0.to_string())
print(o1.to_string())
print(o2.to_string())
Example #6
0
from model.group import Group
from model.outcome import Outcome
from model.plot import Plot
from model.setting import Setting
from persistence import writer

s0 = Setting(0, "version", "name", "path", "filename", "extension", "args",
             "stdin", 1, 1, True, 1, 1)
s1 = Setting(1, "version1", "name1", "path1", "filename", "extension", "args",
             "stdin")
s2 = Setting(2, "version2", "name2", "path2", "filename", "extension", "args",
             "stdin", 1, 1, True)

writer.write_settings('../settings.csv', [s0, s1, s2])

o0 = Outcome(0, 0.01230)
o1 = Outcome(0, 0.1131231)
o2 = Outcome(0, 0.3231230)

o00 = Outcome(1, 0.121231230)
o01 = Outcome(1, 0.1113123)
o02 = Outcome(1, 0.321231230)

outcomes = [o0, o1, o2, o00, o01, o02]

outcomes_file = writer.get_outcome_file('../outcomes.csv')
writer.write_outcome(outcomes_file, o0)
writer.write_outcome(outcomes_file, o1)
outcomes_file.close()

writer.write_outcomes('../outcomes.csv', outcomes)