Repository navigation
Pipeline to run library benchmarks #372
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
Merged
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
8662d24
add pipeline first draft and compress schema name
ipmach 7a0511e
add correct typing in the config arguments
ipmach f53061a
find configs in ipy
ipmach aaac6d2
add to find component instead of the other
ipmach 9874b21
preparing tests
ipmach ff92f40
add optional name in pick component
ipmach c92dbab
add pickcomponents
ipmach 65d826d
draft pipeline full implemented
ipmach 034dbd6
add pipeline first tests
ipmach 254c062
add all pipeline tests
ipmach 07f4d0e
Merge branch 'development' into feat/pipeline
ipmach 4f5f52c
add full pipeline test
ipmach 3805932
minor change
ipmach 7274ee1
add documentation for pick_you
ipmach 5057261
minor git correction issue
ipmach fa4e4ce
update documentation
ipmach 0009143
minor type correction in the dummy alert aggregator
ipmach 000512a
add parallelization in the main pipeline
ipmach 2794646
add parallelization in the main pipeline
ipmach 795094f
minor add on
ipmach 5fba4d0
correct unittest
ipmach 3b2ba15
improve explanation in the documentation
ipmach 3fc2b9d
rename methods
ipmach 44cc431
rename ipy to selc
ipmach File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| # --8<-- [start:example_1] | ||
| from detectmatelibrary.alert_aggregation.logid_count import LogIDCountAggegationConfig | ||
|
|
||
| from detectmatelibrary.parsers.tree_matcher import TemplateCppTreeMatcherConfig | ||
|
|
||
| from detectmatelibrary.detectors.charset_detector import CharsetDetectorConfig | ||
|
|
||
| from detectmatelibrary.pipeline import PipelineConfig, Pipeline | ||
| import detectmatelibrary.schemas as schemas | ||
|
|
||
| config = PipelineConfig( | ||
| do_parsing=True, # Use the parser | ||
| do_aggregation=True, # Use the aggregator | ||
| parser=TemplateCppTreeMatcherConfig( | ||
| path_templates="docs/examples/data/tutorial_templates.txt", | ||
| log_format="type=<Type> msg=audit(<Time>): <Content>" | ||
| ), | ||
| n_workers=1, # You can add parallelization for the detectors | ||
| detectors=[ | ||
| { | ||
| "detectors": { | ||
| "ECVCDetector": { | ||
| "method_type": "ecvc_detector", | ||
| "data_use_configure": 100, | ||
| "window_size": 10, | ||
| "seed": 0, | ||
| "validation_per": 0., | ||
| "threshold_method": "mean" | ||
| } | ||
| } | ||
| }, | ||
| CharsetDetectorConfig( | ||
| data_use_configure=100, | ||
| data_use_training=1, | ||
| auto_config=True, | ||
| ) | ||
| ], | ||
| aggregator=LogIDCountAggegationConfig(max_count=1) | ||
| ) | ||
|
|
||
| pipeline = Pipeline(config=config) | ||
| pipeline.process(schemas.LogSchema({ | ||
| "logID": "0", | ||
| "log": "pid=9699 uid=0 auid=4294967295 ses=4294967295 msg='op=PAM:accounting acct=\"root\"'", | ||
| })) | ||
| # --8<-- [end:example_1] | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
|
|
||
|
ipmach marked this conversation as resolved.
|
||
| # --8<-- [start:pickyou] | ||
| from detectmatelibrary.detectors.random_detector import RandomDetectorConfig | ||
|
|
||
| import detectmatelibrary.helper.select_component as selc | ||
|
|
||
| configs = [ | ||
| { | ||
| "detectors": { | ||
| "a": {"method_type": "random_detector"} | ||
| } | ||
| }, | ||
| RandomDetectorConfig(), | ||
| ] | ||
| names = ["a", "b"] | ||
|
|
||
| components = selc.selectComponents( | ||
| configs=configs, names=names, component_type="detectors" | ||
| ) | ||
| print(len(components)) # 2 | ||
|
|
||
| # --8<-- [end:pickyou] | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| # Select Component | ||
|
|
||
| Methods that make it easy to choose components solely through configuration settings. | ||
|
|
||
| ```python | ||
| def selectComponent( | ||
| config: CoreConfig | dict[str, Any], | ||
| component_type: str, | ||
| name: Optional[str] = None | ||
| ) -> CoreComponent: | ||
| """Select a single component""" | ||
|
|
||
|
|
||
| def selectComponents( | ||
| configs: list[CoreConfig | dict[str, Any]], | ||
| component_type: str, | ||
| names: Optional[list[str | None]] = None | ||
| ) -> list[CoreComponent]: | ||
| """Select multiple components""" | ||
| ``` | ||
|
|
||
| ## Usage | ||
|
|
||
| ```python | ||
| --8<-- "docs/examples/others/select_component.py:pickyou" | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| # Pipelines | ||
|
|
||
| Pipelines that enable running the various components within the library, simulating the final behavior delivered by the service. | ||
|
|
||
|
|
||
| ## Main pipeline | ||
|
|
||
| The main pipeline functions like a standard inference pipeline. To initialize the entire system, the user only needs to provide either a configuration dictionary or the configuration classes themselves. Since the pipeline inherits from [CoreComponent](advanced/overall_architecture.md), all CoreComponent methods are also available in the pipeline class. | ||
|
|
||
| If `do_parsing=False`, the pipeline will take already-parsed logs as input, and the parsing step will be skipped. Likewise, if `do_aggregation=False`, the pipeline will output the detectors’ alerts directly, and the alert aggregation step will be skipped. | ||
|
|
||
| The pipeline allows you to pass either a Config class instance or the dictionary used to initialize that Config class as arguments to the various components. For the detectors list, both methods can be combined, as shown in the example. | ||
|
|
||
| ### Example | ||
|
|
||
| ```python | ||
| --8<-- "docs/examples/others/pipeline.py:example_1" | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| from .basic_concat import BasicConcatAggregation, BasicConcatAggregationConfig | ||
| from .logid_count import LogIDCountAggegation, LogIDCountAggegationConfig | ||
|
|
||
| __all__ = [ | ||
| "BasicConcatAggregation", | ||
| "BasicConcatAggregationConfig", | ||
| "LogIDCountAggegation", | ||
| "LogIDCountAggegationConfig", | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.