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

fix: default elastic geoip to disabled and merge elastic environment #51

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
17 changes: 9 additions & 8 deletions devcluster/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,16 +157,19 @@ def __init__(self, config: Any) -> None:
self.elastic_port = int(config.get("elastic_port", 9300))

self.environment = check_dict_of_strings(
config.get(
{
"discovery.type": "single-node",
"cluster.routing.allocation.disk.threshold_enabled": "false",
"logger.level": "WARN",
"ingest.geoip.downloader.enabled": "false",
}
| config.get(
Copy link
Contributor

Choose a reason for hiding this comment

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

this syntax requires py 3.9 and I believe we still run on 3.7 and 3.8 sometimes, so I'd suggest using some other way to merge dicts e.g.

    {
                "discovery.type": "single-node",
                "cluster.routing.allocation.disk.threshold_enabled": "false",
                "logger.level": "WARN",
                "ingest.geoip.downloader.enabled": "false",
                **config.get(....
            }

"environment",
{
"discovery.type": "single-node",
"cluster.routing.allocation.disk.threshold_enabled": "false",
"logger.level": "WARN",
},
{},
),
"ElasticConfig.environment must be a dict of strings to strings",
)

self.data_dir = read_path(config.get("data_dir"))
self.container_name = str(config.get("container_name", "determined_elastic"))
self.name = str(config.get("name", "elastic"))
Expand All @@ -185,7 +188,6 @@ def build_stage(
state_machine: "dc.StateMachine",
process_tracker: "dc.ProcessTracker",
) -> "dc.Stage":

if self.data_dir:
# elastic is gonna have a bad day if this directory doesn't exist yet.
try:
Expand Down Expand Up @@ -260,7 +262,6 @@ def build_stage(
state_machine: "dc.StateMachine",
process_tracker: "dc.ProcessTracker",
) -> "dc.Stage":

if self.data_dir:
run_args = ["-v", f"{self.data_dir}:/var/lib/postgresql/data"]
else:
Expand Down
1 change: 1 addition & 0 deletions devcluster/example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ stages:
# # discovery.type: "single-node"
# # cluster.routing.allocation.disk.threshold_enabled: "false"
# # logger.level: "WARN"
# # ingest.geoip.downloader.enabled: "false"

# # data_dir is where the persistent files will be saved to. If this key
# # is not present, the elastic logs will not persist at all.
Expand Down