-
Notifications
You must be signed in to change notification settings - Fork 1
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
Added benchmarking capabilities for the mongodb benchmark #23
Open
anish-palakurthi
wants to merge
7
commits into
utcs-scea:main
Choose a base branch
from
anish-palakurthi:benchmark_repo
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+2,040
−0
Open
Changes from 5 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
35e9fb6
adding mongodb
596b185
need to persist env var, iso'd issue to mdb
d3c851b
runners:
anish-palakurthi e394c95
modified export
anish-palakurthi 74c071f
Merge branch 'main' into benchmark_repo
anish-palakurthi 18341e7
addressed pr comments
anish-palakurthi 891f6ed
Merge branch 'main' into benchmark_repo
anish-palakurthi 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 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 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 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 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,90 @@ | ||
import subprocess | ||
from dataclasses import dataclass | ||
from typing import Literal, cast | ||
|
||
from data_schema import GraphEngine, demote | ||
from kernmlops_benchmark.benchmark import Benchmark, GenericBenchmarkConfig | ||
from kernmlops_benchmark.errors import ( | ||
BenchmarkNotInCollectionData, | ||
BenchmarkNotRunningError, | ||
BenchmarkRunningError, | ||
) | ||
from kernmlops_config import ConfigBase | ||
|
||
|
||
@dataclass(frozen=True) | ||
class BenchmarkConfig(ConfigBase): | ||
|
||
recordCount: int = 1000000 | ||
readProportion: float = 0.25 | ||
updateProportion: float =0.75 | ||
|
||
|
||
class MongoDbBenchmark(Benchmark): | ||
|
||
@classmethod | ||
def name(cls) -> str: | ||
return "mongodb" | ||
|
||
@classmethod | ||
def default_config(cls) -> ConfigBase: | ||
return BenchmarkConfig() | ||
|
||
@classmethod | ||
def from_config(cls, config: ConfigBase) -> "Benchmark": | ||
generic_config = cast(GenericBenchmarkConfig, getattr(config, "generic")) | ||
gap_config = cast(BenchmarkConfig, getattr(config, cls.name())) | ||
anish-palakurthi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return MongoDbBenchmark(generic_config=generic_config, config=gap_config) | ||
|
||
def __init__(self, *, generic_config: GenericBenchmarkConfig, config: BenchmarkConfig): | ||
self.generic_config = generic_config | ||
self.config = config | ||
self.benchmark_dir = self.generic_config.get_benchmark_dir() / self.name() | ||
self.process: subprocess.Popen | None = None | ||
|
||
def is_configured(self) -> bool: | ||
return True | ||
# print(f'is_configured directory name: {self.benchmark_dir}') | ||
return self.benchmark_dir.is_dir() | ||
|
||
def setup(self) -> None: | ||
if self.process is not None: | ||
raise BenchmarkRunningError() | ||
self.generic_config.generic_setup() | ||
|
||
def run(self) -> None: | ||
if self.process is not None: | ||
raise BenchmarkRunningError() | ||
|
||
bash_file_path = self.benchmark_dir / "run_mongodb.sh" # Add the path to your bash file here | ||
print(bash_file_path) | ||
self.process = subprocess.Popen( | ||
[ | ||
"bash", | ||
bash_file_path, | ||
anish-palakurthi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
], | ||
preexec_fn=demote(), | ||
stdout=subprocess.DEVNULL, | ||
) | ||
|
||
def poll(self) -> int | None: | ||
if self.process is None: | ||
raise BenchmarkNotRunningError() | ||
return self.process.poll() | ||
|
||
def wait(self) -> None: | ||
if self.process is None: | ||
raise BenchmarkNotRunningError() | ||
self.process.wait() | ||
|
||
def kill(self) -> None: | ||
if self.process is None: | ||
raise BenchmarkNotRunningError() | ||
self.process.terminate() | ||
|
||
@classmethod | ||
def plot_events(cls, graph_engine: GraphEngine) -> None: | ||
if graph_engine.collection_data.benchmark != cls.name(): | ||
raise BenchmarkNotInCollectionData() | ||
# TODO(Patrick): plot when a trial starts/ends |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use lower snake case instead of camel case, i.e.
record_count
note: Pascal case is fine for class names as you have done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, after you make the above fix, please run
make defaults
to generate a newdefaults.yaml
and then commit those changesThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, it does not look like you use these configuration options at all anywhere
Please use them to configure the mongodb benchmark
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make defaults is consistently failing with this: