amol- commented on a change in pull request #10650:
URL: https://github.com/apache/arrow/pull/10650#discussion_r672361345



##########
File path: dev/archery/archery/crossbow/reports.py
##########
@@ -121,6 +124,32 @@ def show(self, outstream, asset_callback=None):
                                    asset))
 
 
+class JsonReport(Report):
+
+    def url(self, query):
+        repo_url = self.job.queue.remote_url.strip('.git')
+        return '{}/branches/all?query={}'.format(repo_url, query)
+
+    def today_str(self):
+        date = datetime.utcnow()
+        return "{}-{}-{}".format(date.year, date.month, date.day)
+
+    def tasks_to_dict(self, date, tasks):
+        json_tasks = []
+        for task_name, task in tasks.items():
+            json_tasks.append({
+                "build": task_name,
+                "link": self.url(task.branch),
+                "status": task.status().combined_state.upper(),
+                "timestamp": date})
+
+        return json_tasks
+
+    def get_json_tasks(self):
+        tasks = self.tasks_to_dict(self.today_str(), self.job.tasks.items())
+        json_str = json.dump(tasks)

Review comment:
       I think this wants to be `json.dumps(tasks)` as `json.dump` wants a 
target file, while your goal here is to return as tring.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to