Mforns has uploaded a new change for review.
https://gerrit.wikimedia.org/r/276758
Change subject: Add the query folder as the last parameter of scripts
......................................................................
Add the query folder as the last parameter of scripts
Some scripts may want to easily know the directory where they are
being executed. So this change adds that path as a last parameter
to the script call.
Bug: T127326
Change-Id: I231edb7dea7ff37de8118b24f1e6253d34650629
---
M reportupdater/executor.py
M test/executor_test.py
2 files changed, 3 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/analytics/reportupdater
refs/changes/58/276758/1
diff --git a/reportupdater/executor.py b/reportupdater/executor.py
index 7eb2007..7eb083c 100644
--- a/reportupdater/executor.py
+++ b/reportupdater/executor.py
@@ -9,6 +9,7 @@
import logging
import subprocess
import csv
+import os
from datetime import datetime, date
from selector import Selector
from collections import defaultdict
@@ -152,6 +153,7 @@
for dimension in sorted(report.explode_by.keys()):
value = report.explode_by[dimension]
parameters.append(value)
+ parameters.append(os.path.dirname(report.script))
# execute the script, store its output in a pipe
try:
process = subprocess.Popen(parameters, stdout=subprocess.PIPE)
diff --git a/test/executor_test.py b/test/executor_test.py
index 7882f49..c41dbce 100644
--- a/test/executor_test.py
+++ b/test/executor_test.py
@@ -37,6 +37,7 @@
self.report = Report()
self.report.type = 'sql'
+ self.report.script = '/some/path'
self.report.is_timeboxed = True
self.report.start = datetime(2015, 1, 1)
self.report.end = datetime(2015, 1, 2)
--
To view, visit https://gerrit.wikimedia.org/r/276758
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I231edb7dea7ff37de8118b24f1e6253d34650629
Gerrit-PatchSet: 1
Gerrit-Project: analytics/reportupdater
Gerrit-Branch: master
Gerrit-Owner: Mforns <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits