Skip to content

New profiler with output to the CSV file#303

Open
Thematiq wants to merge 2 commits into
Prpht:um-2023-zimafrom
Thematiq:feat/upgraded_profiler
Open

New profiler with output to the CSV file#303
Thematiq wants to merge 2 commits into
Prpht:um-2023-zimafrom
Thematiq:feat/upgraded_profiler

Conversation

@Thematiq

Copy link
Copy Markdown
Contributor

Nowy profiler do celów ogólnej analizy działania botów. Pozwala na zapisywania wyników od razu do formatu CSV

@Prpht Prpht left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wielkie dzięki za robotę przy profilerze - ale wymaga jeszcze troszkę sprzątania, żeby trzymać ogólne konwencje tego repozytorium. Chętnie zmerguję po poprawkach (i tak jak obiecywałem na starcie semestru - rzucę dodatkowym punktem).

Comment thread gupb/model/pandas_profiler.py Outdated
@@ -0,0 +1,164 @@
from time import time

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To nie jest część modelu, więc raczej do wyrzucenia do osobnego pod-pakietu ("profiler"?).

return decorator(_func) if _func else decorator


PROFILER_SINGLETON = ProfilerContainer()

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Zamiast jednego singletona pasowałoby umożliwić pobieranie sobie pre-przygotowanego obiektu, podobnie jak w przypadku loggera.

from os import makedirs, path
from gc import get_referents

import sys

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Importy niezgodne z konwencją repo. Konwencja: importy z biblioteki standardowej (alfabetycznie), pusta linia, importy z bibliotek zależnych, pusta linia, importy z samego GUPB.

Comment thread gupb/model/pandas_profiler.py Outdated
BLACKLIST = type, ModuleType, FunctionType


def getsize(obj):

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nieotypowane funkcje.

Comment thread gupb/model/pandas_profiler.py Outdated
def header():
return (
"epoch,step,controller_name,decision_time,memory_before,memory_after,"
+ "action_name,exception_returned\n"

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To mogłoby powstawać dynamicznie w oparciu o nazwy pól w dataclass, tak samo metoda str - obecnie jest sporo powtórzonego kodu.

self.epoch = 0
self.step = 0
self.batch_size = batch_size
self.batch = []

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nieotypowane.

Comment thread gupb/model/pandas_profiler.py Outdated
self.batch_size = batch_size
self.batch = []

def __open_file(self):

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

__ sugerują wewnętrzną funkcję o określonym znaczeniu (jak str), dla funkcji "prywatnych" wystarczy jeden _

Comment thread profiling.md
@@ -1,4 +1,8 @@
[Basic profiler](#profiling-header)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No i to też może wylądować w odpowiednim pod-pakiecie.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants