Skip to content
Merged
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
72 changes: 17 additions & 55 deletions lib/ramble/ramble/keywords.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,24 @@
# except according to those terms.

import re
from enum import Enum
from enum import Enum, auto

import ramble.error
from ramble.repository import type_definitions
from ramble.util.logger import logger

key_type = Enum("key_type", ["reserved", "optional", "required"])
output_level = Enum("output_level", ["key", "variable"])

class key_type(Enum):
reserved = auto()
optional = auto()
required = auto()


class output_level(Enum):
key = auto()
variable = auto()


default_keys = {
"workspace_name": {"type": key_type.reserved, "level": output_level.variable},
"workspace": {"type": key_type.reserved, "level": output_level.variable},
Expand Down Expand Up @@ -105,58 +115,10 @@ class Keywords:
specific inputs to further configure the experiment.
"""

workspace_name: str
workspace: str
workspace_root: str
workspace_configs: str
workspace_software: str
workspace_logs: str
workspace_inputs: str
workspace_experiments: str
workspace_shared: str
workspace_archives: str
workspace_deployments: str
application_name: str
application_spec: str
application_run_dir: str
application_input_dir: str
application_namespace: str
application_version: str
simplified_application_namespace: str
workload_name: str
workload_run_dir: str
workload_input_dir: str
workload_namespace: str
simplified_workload_namespace: str
workload_group: str
license_input_dir: str
experiments_file: str
experiment_name: str
experiment_hash: str
experiment_run_dir: str
experiment_status: str
RAMBLE_STATUS: str
experiment_index: str
experiment_namespace: str
simplified_experiment_namespace: str
log_dir: str
log_file: str
err_file: str
env_path: str
input_name: str
repeat_index: str
spec_name: str
env_name: str
n_ranks: str
n_nodes: str
processes_per_node: str
n_threads: str
batch_submit: str
mpi_command: str
workload_template_name: str
experiment_template_name: str
unformatted_command: str
unformatted_command_without_logs: str
# Keyword attributes are set dynamically in update_keys(). This is only
# reached for unknown attributes, and tells type checkers keywords are str.
def __getattr__(self, name: str) -> str:
raise AttributeError(f"'{type(self).__name__}' object has no attribute '{name}'")

def __init__(self, extra_keys=None):
# Merge in additional Keys:
Expand Down
3 changes: 2 additions & 1 deletion lib/ramble/ramble/results_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import copy
import os

from ramble.namespace import namespace
from ramble.util.file_util import create_symlink
from ramble.util.logger import logger
from ramble.util.module_utils import import_pandas
Expand All @@ -18,7 +19,7 @@
class ResultsColumn:
"""Class representing a single column in a results table"""

_where_name = "where"
_where_name = namespace.where
_column_attrs = [
"name",
"expression",
Expand Down
30 changes: 18 additions & 12 deletions lib/ramble/ramble/variants.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,38 +8,44 @@

import functools
from collections.abc import Sequence
from enum import Enum
from enum import Enum, auto
from typing import Any, Callable, Dict, Optional, Union

import ramble.error
import ramble.util.colors as color
from ramble.expander import Expander
from ramble.keywords import keywords
from ramble.namespace import namespace

from spack.util.spack_yaml import syaml_bool

reserved_variants = {
"modifier",
"package_manager",
namespace.package_manager,
"package_manager_prefix",
"system",
"platform",
"version",
"workflow_manager",
"workload_group",
"is_repeat_child",
"is_repeat_parent",
"repeat_index",
namespace.system,
namespace.platform,
namespace.version,
namespace.workflow_manager,
keywords.workload_group,
keywords.is_repeat_child,
keywords.is_repeat_parent,
keywords.repeat_index,
}

standard_variants: Dict[str, Dict[str, Any]] = {
"containerized": {
namespace.containerized: {
"default": False,
"values": (True, False),
"description": "Whether this experiment is run inside a container",
},
}

variant_types = Enum("variant_types", ["default", "experiment", "version"])

class variant_types(Enum):
default = auto()
experiment = auto()
version = auto()


def invalidates_cache(func):
Expand Down
Loading