Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

[DO NOT MERGE] Collect duration data #64

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ jobs:
- name: Run pytest (not unit, including running notebooks)
run: |
pytest --verbose -m 'not unit' tests/
- name: Save build log
uses: actions/upload-artifact@v2
if: always()
with:
name: ${{ matrix.os }}-${{ matrix.python-version }}-build-log
path: build-log.jsonl
- name: Save build error logs
uses: actions/upload-artifact@v2
if: failure()
Expand Down
19 changes: 19 additions & 0 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
from collections import namedtuple
from datetime import datetime
import glob
import json
from io import StringIO
import logging
import os
Expand Down Expand Up @@ -113,6 +114,18 @@
_log.setLevel(logging.INFO)


def _log_json(path='build-log.jsonl', **kwargs):
import platform
data = dict(
kwargs,
platform=platform.platform(),
python_version=platform.python_version(),
)
json_str = json.dumps(data, default=str)
with Path(path).open('a') as f:
print(json_str, file=f, sep='\n')


# This is a workaround for a bug in some versions of Tornado on Windows for Python 3.8
# this is the recommended fix for this according to e.g. https://github.com/tornadoweb/tornado#2608
# it should be revisited with python>=3.9 or if a fix is implemented by e.g. Jupyter
Expand Down Expand Up @@ -738,6 +751,12 @@ def convert(self, id_, job, log_q) -> ConversionResult:
self.log_info(
f"Convert notebook name={job.nb}: end, ok={ok} duration={duration:.1f}s"
)
_log_json(
id=id_,
notebook=job.nb,
ok=ok,
duration=duration,
)

return self.ConversionResult(id_, ok, converted, why, job.nb, duration)

Expand Down