Skip to content

Commit

Permalink
Merge pull request #113 from vkottler/dev/2.6.8
Browse files Browse the repository at this point in the history
2.6.8 - Add metrics name symbol
  • Loading branch information
vkottler authored Sep 11, 2023
2 parents db9ca3b + 9c075b5 commit c52757e
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
- run: |
mk python-release owner=vkottler \
repo=runtimepy version=2.6.7
repo=runtimepy version=2.6.8
if: |
matrix.python-version == '3.11'
&& matrix.system == 'ubuntu-latest'
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
=====================================
generator=datazen
version=3.1.3
hash=790eb511bd706c64175f59e2d84fb0c5
hash=b00889b261f786062d9c52086554c0ff
=====================================
-->

# runtimepy ([2.6.7](https://pypi.org/project/runtimepy/))
# runtimepy ([2.6.8](https://pypi.org/project/runtimepy/))

[![python](https://img.shields.io/pypi/pyversions/runtimepy.svg)](https://pypi.org/project/runtimepy/)
![Build Status](https://github.com/vkottler/runtimepy/workflows/Python%20Package/badge.svg)
Expand Down
3 changes: 3 additions & 0 deletions local/configs/package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ commands:
description: "run a connection-arbiter application from a config"
- name: tui
description: "run a terminal interface for the channel environment"

init_local: |
METRICS_NAME = "metrics"
2 changes: 1 addition & 1 deletion local/variables/package.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
major: 2
minor: 6
patch: 7
patch: 8
entry: runtimepy
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta:__legacy__"

[project]
name = "runtimepy"
version = "2.6.7"
version = "2.6.8"
description = "A framework for implementing Python services."
readme = "README.md"
requires-python = ">=3.10"
Expand Down
7 changes: 5 additions & 2 deletions runtimepy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# =====================================
# generator=datazen
# version=3.1.3
# hash=18c7312c2ee34e91a3d363293ed7202d
# hash=cba19142d304f4387692458f31708575
# =====================================

"""
Expand All @@ -10,4 +10,7 @@

DESCRIPTION = "A framework for implementing Python services."
PKG_NAME = "runtimepy"
VERSION = "2.6.7"
VERSION = "2.6.8"

# runtimepy-specific content.
METRICS_NAME = "metrics"
3 changes: 3 additions & 0 deletions runtimepy/channel/environment/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
)
from runtimepy.channel.environment.base import ChannelResult as _ChannelResult
from runtimepy.enum import RuntimeEnum as _RuntimeEnum
from runtimepy.enum.registry import DEFAULT_ENUM_PRIMITIVE
from runtimepy.enum.type import EnumTypelike as _EnumTypelike
from runtimepy.mapping import EnumMappingData as _EnumMappingData
from runtimepy.primitives import Primitive
Expand Down Expand Up @@ -115,13 +116,15 @@ def enum(
kind: _EnumTypelike,
items: _EnumMappingData = None,
namespace: _Namespace = None,
primitive: str = DEFAULT_ENUM_PRIMITIVE,
) -> _RuntimeEnum:
"""Create a new enum from the environment."""

result = self.enums.enum(
self.namespace(name=name, namespace=namespace),
kind=kind,
items=items,
primitive=primitive,
)
assert result is not None, f"Can't create enum '{name}'!"
return result
2 changes: 1 addition & 1 deletion runtimepy/data/schemas/EnumRegistry.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ type: object
additionalProperties: false

patternProperties:
"^[\\w\\:]+$":
"^[\\w\\:-_.]+$":
$ref: package://runtimepy/schemas/RuntimeEnum.yaml
5 changes: 3 additions & 2 deletions runtimepy/mixins/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""

# internal
from runtimepy import METRICS_NAME
from runtimepy.channel.environment import ChannelEnvironment
from runtimepy.metrics import ConnectionMetrics, PeriodicTaskMetrics

Expand All @@ -20,7 +21,7 @@ def __init__(self, env: ChannelEnvironment = None, **kwargs) -> None:
self.env = env

def register_task_metrics(
self, metrics: PeriodicTaskMetrics, namespace: str = "metrics"
self, metrics: PeriodicTaskMetrics, namespace: str = METRICS_NAME
) -> None:
"""Register periodic task metrics."""

Expand All @@ -32,7 +33,7 @@ def register_task_metrics(
self.env.channel("min_s", metrics.min_s)

def register_connection_metrics(
self, metrics: ConnectionMetrics, namespace: str = "metrics"
self, metrics: ConnectionMetrics, namespace: str = METRICS_NAME
) -> None:
"""Register connection metrics."""

Expand Down
2 changes: 1 addition & 1 deletion runtimepy/mixins/regex.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from re import Pattern as _Pattern
from re import compile as _compile

DEFAULT_PATTERN = _compile("^[\\w\\:]+$")
DEFAULT_PATTERN = _compile("^[\\w\\:-_.]+$")
CHANNEL_PATTERN = _compile("^[a-z0-9-_.]+$")


Expand Down
3 changes: 2 additions & 1 deletion runtimepy/task/asynchronous.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from vcorelib.math import rate_str as _rate_str

# internal
from runtimepy import METRICS_NAME
from runtimepy.channel.environment import (
ChannelEnvironment as _ChannelEnvironment,
)
Expand Down Expand Up @@ -51,7 +52,7 @@ def __init__(
)[0]
self.max_iterations.raw.value = max_iterations

with env.names_pushed("metrics"):
with env.names_pushed(METRICS_NAME):
# Track the number of times this task has been dispatched.
self.dispatches = env.int_channel("dispatches", kind="uint8")[
0
Expand Down

0 comments on commit c52757e

Please sign in to comment.