# Path: kubeface/naming.py
# def hash_value(s, characters=8):
#     return hashlib.sha1(str(s).encode()).hexdigest()[:characters]


from .naming import hash_value
"""
This module defines information that allows code to determine if it is running
on a master Kubeface node (node_type == "master") or as a task
(node_type == "task").

This dict defaults to indicating running on a master node, and is updated by
the run-task command with task-specific information.
"""


RUNTIME_CONTEXT = {
    "node_type": "master",
    "task_input_path": None,
    "task_result_path": None,
}


def node_id():
    if RUNTIME_CONTEXT["node_type"] == "master":
        return "node-master"
    return "node-%s" % (

# Path: kubeface/naming.py
# def hash_value(s, characters=8):
#     return hashlib.sha1(str(s).encode()).hexdigest()[:characters]


# Path: kubeface/context.py
from .naming import hash_value

"""
This module defines information that allows code to determine if it is running
on a master Kubeface node (node_type == "master") or as a task
(node_type == "task").

This dict defaults to indicating running on a master node, and is updated by
the run-task command with task-specific information.
"""


RUNTIME_CONTEXT = {
    "node_type": "master",
    "task_input_path": None,
    "task_result_path": None,
}


def node_id():
    if RUNTIME_CONTEXT["node_type"] == "master":
        return "node-master"
    return "node-%s" % (

        hash_value(