Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[V2 Loggers] config file #1533

Merged
merged 4 commits into from
Jan 24, 2024
Merged

[V2 Loggers] config file #1533

merged 4 commits into from
Jan 24, 2024

Conversation

horheynm
Copy link
Member

@horheynm horheynm commented Jan 16, 2024

Screenshot 2024-01-18 at 10 53 12 AM

Config for validation

Description

Config yaml file has five top level properties: version, logging, system, performance and metric.
version is always 2, since its for v2 pipeline
logging is the name of the defined logging (class LoggingFoo: here the name is LoggingFoo) which are singletons (one instance per any Name).
Sys, Perf and Met are the three entry points to use the Logger.
System is for default python (import logging) logging
Performance is for logging any hardware, benchmark,..etc metric-related log (thing that are already defined).
Metric is for input related logging (output value based on inputs).

If logging has any args for instantiation, one can define as

loggers:
  logger_id:
    name: FooLogger
    arg1: 1
    arg2: 2

For the three entry points, the top level after the root logger (system, metric, performance) is called the tag. Tags are used to filter out and log in any matching tag by regex.
Under tags, we have three (four in metrics) properties,
func is the function to apply to any value of interest to log.
freq is the rate to log once a matching entry is encountered.
uses: is a list to specify which logger to use, selected by logger_id

capture (metric only): key of the dict, property name to extract from the output of an operator, ran in logging middleware

system: # Python/system level logging
  ".*": # reges tag to capture
  - func: identity # func name or path/to/file.py:func_name
    freq: 1 # rate to log
    uses: # which logger to use, point to the log id above
    - default 
metric:
  ".*":
  - func: max
    freq: 1
    uses:
    - list
    capture:  # The key, property to log. Ex rtn: Operator = AddOneOperator(...), if capture is set to value, it would record rtn.capture, if tag above is set to any regex that recognizes AddOneOperator (currently set to ".*")
    - ".*" # log every key, property that the dict, class has

In other words, for each root logger, what tags are we logging. With respect to tags, what function are we applying if any, at what rate and with respect to what loggers are we using

Root logger is a function of tags, tags are a fucntion of frequency, func and loggers.
Root logger(tag(freq, func, loggers, capture))

Examples

version: 2 # v2 uses 2

loggers:
  list: # Logger ID
    name: ListLogger # class name or path/to/file.py:ClassName
    handler: None # Handler config, default set to default logging 
  default: 
    name: PythonLogger 
    handler: None
system: # Python/system level logging
  ".*": # reges tag to capture
  - func: identity # func name or path/to/file.py:func_name
    freq: 1 # rate to log
    uses: # which logger to use, point to the log id above
    - default 
performance:
  cpu:
  - func: identity
    freq: 1
    uses:
    - default
metric:
  ".*":
  - func: max
    freq: 1
    uses:
    - list
    capture:  # The key, property to log. Ex rtn: Operator = AddOneOperator(...), if capture is set to value, it would record rtn.capture, if tag above is set to any regex that recognizes AddOneOperator (currently set to ".*")
    - ".*"

Default config without any inputs

version: 2
loggers:
  list:
    name: ListLogger
    handler: None
  default:
    name: PythonLogger
    handler: None
system:
  ".*":
  - func: identity
    freq: 1
    uses:
    - default
performance:
  cpu:
  - func: identity
    freq: 1
    uses:
    - default
metric:
  ".*":
  - func: max
    freq: 1
    uses:
    - list
    capture:
    - ".*"

TODO: Handlers

@horheynm horheynm changed the title config file [V2 Loggers] config file Jan 17, 2024
@horheynm horheynm changed the base branch from main to v2/logger January 18, 2024 15:27
This was referenced Jan 18, 2024
@horheynm horheynm marked this pull request as ready for review January 18, 2024 16:36
src/deepsparse/loggers_v2/config.py Show resolved Hide resolved
src/deepsparse/loggers_v2/config.py Outdated Show resolved Hide resolved
src/deepsparse/loggers_v2/config.py Outdated Show resolved Hide resolved
src/deepsparse/loggers_v2/config.py Outdated Show resolved Hide resolved
Copy link
Member

@bfineran bfineran left a comment

Choose a reason for hiding this comment

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

lgtm pending comments

src/deepsparse/loggers_v2/config.py Outdated Show resolved Hide resolved
@horheynm horheynm merged commit b963ebc into v2/logger Jan 24, 2024
@horheynm horheynm deleted the v2/logers-config branch January 24, 2024 12:57
horheynm added a commit that referenced this pull request Feb 15, 2024
* logger feature beanch

* [V2 Logger]  utils for import (#1536)

* utils for import

* clean up + tests

* [V2 Logger] registry for default func/class (#1539)

* registry for default func/class

* prometheus logger

* clean up

* clean up

* remove ListLogger import, moved to tests

* add base logger for type checking

* exmaple

* [V2 Logger] Filters (#1540)

* filters

* cleaner logic

* fix bug -- if config has duplicated tag.func with different freq

* delete config test

* move unravel_value_as_generator to pattern.py

* tests

* doc string

* exact match

* async submitter (#1538)

* manager (#1541)

* [V2 Loggers] logger manager patch (#1560)

* manager

* doc string

* [V2 Loggers] config file (#1533)

* config file

* test

* comments

* comments

* pipeline tests (#1553)

* [V2 Logger] root logger (#1542)

* root logger

* only get func's with respect to the tag

* fix bug for duplicated tag.log_type

* clena up

* doc strings:

* loosen up rules for capture

* [V2 Logger]  factory (#1537)

* factory

* docstring

* [V2 Logger] logger middleware (#1543)

* logger middleware

* yield individual eleeents in a list

* comments

* edit state

* polish, passes tests

* pass middleware

* edit condition to add logger to inference state

* set default logger manager

* delete og prometheus logger test

* fix in test_basic_logger

* move loggers to legacy and pass tests, circular imports

* move tests/deepsparse/loggers to tests/deepsparse/legacy/loggers and pass tests

* move loggers_v2 to logger for src and tests, pass logger tests

* fix tests and rename legacy logger tests to _legacy_

* pass tests, wait for async logs to complete'

* doc string typo and change default to re:.*

* fix frequency test bug on text gen

* wait for async loggers to finish before counting

* get rid of capture, inconsistent number of fields per log calls cause error
horheynm added a commit that referenced this pull request Feb 20, 2024
* logger feature beanch

* [V2 Logger]  utils for import (#1536)

* utils for import

* clean up + tests

* [V2 Logger] registry for default func/class (#1539)

* registry for default func/class

* prometheus logger

* clean up

* clean up

* remove ListLogger import, moved to tests

* add base logger for type checking

* exmaple

* [V2 Logger] Filters (#1540)

* filters

* cleaner logic

* fix bug -- if config has duplicated tag.func with different freq

* delete config test

* move unravel_value_as_generator to pattern.py

* tests

* doc string

* exact match

* async submitter (#1538)

* manager (#1541)

* [V2 Loggers] logger manager patch (#1560)

* manager

* doc string

* [V2 Loggers] config file (#1533)

* config file

* test

* comments

* comments

* pipeline tests (#1553)

* [V2 Logger] root logger (#1542)

* root logger

* only get func's with respect to the tag

* fix bug for duplicated tag.log_type

* clena up

* doc strings:

* loosen up rules for capture

* [V2 Logger]  factory (#1537)

* factory

* docstring

* [V2 Logger] logger middleware (#1543)

* logger middleware

* yield individual eleeents in a list

* comments

* edit state

* polish, passes tests

* pass middleware

* edit condition to add logger to inference state

* set default logger manager

* delete og prometheus logger test

* fix in test_basic_logger

* move loggers to legacy and pass tests, circular imports

* move tests/deepsparse/loggers to tests/deepsparse/legacy/loggers and pass tests

* move loggers_v2 to logger for src and tests, pass logger tests

* fix tests and rename legacy logger tests to _legacy_

* pass tests, wait for async logs to complete'

* doc string typo and change default to re:.*

* fix frequency test bug on text gen

* wait for async loggers to finish before counting

* get rid of capture, inconsistent number of fields per log calls cause error
horheynm added a commit that referenced this pull request Feb 22, 2024
* [V2 Logger] Feature branch (#1516)

* logger feature beanch

* [V2 Logger]  utils for import (#1536)

* utils for import

* clean up + tests

* [V2 Logger] registry for default func/class (#1539)

* registry for default func/class

* prometheus logger

* clean up

* clean up

* remove ListLogger import, moved to tests

* add base logger for type checking

* exmaple

* [V2 Logger] Filters (#1540)

* filters

* cleaner logic

* fix bug -- if config has duplicated tag.func with different freq

* delete config test

* move unravel_value_as_generator to pattern.py

* tests

* doc string

* exact match

* async submitter (#1538)

* manager (#1541)

* [V2 Loggers] logger manager patch (#1560)

* manager

* doc string

* [V2 Loggers] config file (#1533)

* config file

* test

* comments

* comments

* pipeline tests (#1553)

* [V2 Logger] root logger (#1542)

* root logger

* only get func's with respect to the tag

* fix bug for duplicated tag.log_type

* clena up

* doc strings:

* loosen up rules for capture

* [V2 Logger]  factory (#1537)

* factory

* docstring

* [V2 Logger] logger middleware (#1543)

* logger middleware

* yield individual eleeents in a list

* comments

* edit state

* polish, passes tests

* pass middleware

* edit condition to add logger to inference state

* set default logger manager

* delete og prometheus logger test

* fix in test_basic_logger

* move loggers to legacy and pass tests, circular imports

* move tests/deepsparse/loggers to tests/deepsparse/legacy/loggers and pass tests

* move loggers_v2 to logger for src and tests, pass logger tests

* fix tests and rename legacy logger tests to _legacy_

* pass tests, wait for async logs to complete'

* doc string typo and change default to re:.*

* fix frequency test bug on text gen

* wait for async loggers to finish before counting

* get rid of capture, inconsistent number of fields per log calls cause error

* fix src. reference (#1607)

---------

Co-authored-by: Benjamin Fineran <bfineran@users.noreply.github.com>
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.

None yet

2 participants