Refactor pretty_print to outine to_csv

This commit is contained in:
Jose Gracia 2024-02-20 16:49:32 +01:00
parent c22959f4b9
commit 5b07b407de

View file

@ -179,9 +179,13 @@ class Power:
def summarize_energy(self): def summarize_energy(self):
return "# Total energy consumed by job: {energy:.0f} J\n".format(energy=self.energy_total()) return "# Total energy consumed by job: {energy:.0f} J\n".format(energy=self.energy_total())
@staticmethod
def to_csv(args):
return ",".join(str(a) for a in args)
@staticmethod @staticmethod
def pretty_print(args): def pretty_print(args):
return ",".join(str(a) for a in args) + '\n' return Power.to_csv(args) + '\n'
def filename(self, jobid): def filename(self, jobid):
fname = "detailed_power_{jobid}.hawk-pbs5.{first}-{last}.csv".format( fname = "detailed_power_{jobid}.hawk-pbs5.{first}-{last}.csv".format(