Skip to content

Commit 927c607

Browse files
authored
Import'ish
From `Autodesk/pull/177`
1 parent 83448e2 commit 927c607

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

updater/reports/Report.py

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,28 @@
99

1010
# Abstract base class for all reports that automates reading and writing reports etc.
1111
class Report(object):
12-
def __init__(self, configuration, dataDirectory, metaStats):
12+
def __init__(self, configuration, dataDirectory, metaStats, repository = None):
1313
self.configuration = configuration
1414
self.dataDirectory = dataDirectory
1515
self.metaStats = metaStats
16+
self.repository = repository
1617
self.header = None
1718
self.data = []
1819
self.detailedHeader = None
1920
self.detailedData = None
20-
21+
22+
if self.repository != None:
23+
self.repositoryOwner = self.repository.split('/')[0]
24+
self.repositoryName = self.repository.split('/')[1]
25+
2126
# Name of the report, must be overridden in subclasses
2227
def name(self):
2328
return "unnamed-report"
24-
29+
30+
# Name of the report within the meta stats report
31+
def metaName(self):
32+
return self.name()
33+
2534
# Determines the output filename of the report
2635
def fileName(self):
2736
return os.path.join(self.dataDirectory, self.name() + ".tsv")
@@ -72,7 +81,7 @@ def executeCommandOnServer(self, command, stdin = None):
7281
] \
7382
+ command
7483

75-
stdout, stderr = executeCommand(command, stdin)
84+
stdout, stderr = executeCommand(command, stdin = stdin, repository = self.repository)
7685

7786
print(stderr.decode("utf-8"), file = sys.stderr)
7887
sys.stderr.flush()
@@ -169,7 +178,7 @@ def updateData(self):
169178

170179
# Performs the update by reading existing data, updating it (as defined by subclass), and writing the result
171180
def update(self):
172-
print("Started update of " + self.name() + ".tsv", file = sys.stderr)
181+
print("Started update of " + self.metaName() + ".tsv", file = sys.stderr)
173182
sys.stderr.flush()
174183

175184
timeStart = time.time()
@@ -179,9 +188,9 @@ def update(self):
179188
self.writeData()
180189

181190
timeElapsed = PrettyFloat(time.time() - timeStart)
182-
self.metaStats["runtimes"].append([self.name(), timeElapsed])
183-
184-
print("Finished update of " + self.name() + ".tsv (runtime: " + str(timeElapsed) + " s)", file = sys.stderr)
191+
self.metaStats["runtimes"].append([self.metaName(), timeElapsed])
192+
193+
print("Finished update of " + self.metaName() + ".tsv (runtime: " + str(timeElapsed) + " s)", file = sys.stderr)
185194
sys.stderr.flush()
186195

187196
def andExcludedEntities(self, column, delimiter = "AND"):

0 commit comments

Comments
 (0)