Skip to content

Commit

Permalink
Add warning when setting option for non-selected queue system
Browse files Browse the repository at this point in the history
  • Loading branch information
xjules committed Nov 3, 2023
1 parent 33da07f commit 515e6af
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/ert/config/queue_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
import logging
import re
import shutil
import warnings
from collections import defaultdict
from dataclasses import dataclass, field
from typing import Any, Dict, List, Mapping, Tuple, no_type_check

from ert import _clib

from .parsing import ConfigDict, ConfigValidationError
from .parsing import ConfigDict, ConfigValidationError, ConfigWarning
from .queue_system import QueueSystem

GENERIC_QUEUE_OPTIONS: List[str] = ["MAX_RUNNING"]
Expand Down Expand Up @@ -58,6 +59,15 @@ def from_dict(cls, config_dict: ConfigDict) -> QueueConfig:
f"Invalid QUEUE_OPTION for {queue_system.name}: '{option_name}'. "
f"Valid choices are {sorted(VALID_QUEUE_OPTIONS[queue_system])}."
)
if queue_system != selected_queue_system:
warnings.warn(
ConfigWarning.with_context(
f"Setting '{option_name}'for {queue_system.name} but "
f"{selected_queue_system.name} is selected. ",
option_name,
),
stacklevel=1,
)
queue_options[queue_system].append(
(option_name, values[0] if values else "")
)
Expand Down

0 comments on commit 515e6af

Please sign in to comment.