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
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ include Makefile.tarball
# Build docs (unused)
###################################
test_prep:
@PIP_CONSTRAINT=$(ROOT)/desktop/core/build-constraints.txt PIP_BUILD_CONSTRAINT=$(ROOT)/desktop/core/build-constraints.txt $(ENV_PYTHON) -m pip install -r $(REQUIREMENT_TEST_FILE)
@PIP_BUILD_CONSTRAINT=$(ROOT)/desktop/core/build-constraints.txt $(ENV_PYTHON) -m pip install -r $(REQUIREMENT_TEST_FILE)

###################################
# Build docs (unused)
Expand Down Expand Up @@ -166,10 +166,10 @@ $(BLD_DIR_ENV)/bin/python:
@$(ENV_PYTHON) -m pip install virtualenv-make-relocatable==$(VIRTUAL_ENV_RELOCATABLE_VERSION)
@$(eval RELOCATABLE := $(shell which virtualenv-make-relocatable))
@echo "REQUIREMENT_FILE is $(REQUIREMENT_FILE)"
@echo "--- Using build constraints to prevent setuptools 82+ (cx-Oracle compatibility) ---"
@PIP_CONSTRAINT=$(ROOT)/desktop/core/build-constraints.txt PIP_BUILD_CONSTRAINT=$(ROOT)/desktop/core/build-constraints.txt $(ENV_PIP) install -r $(REQUIREMENT_FILE)
@echo "--- Building from source with setuptools < 82 in the build environment (cx-Oracle compatibility) ---"
@PIP_BUILD_CONSTRAINT=$(ROOT)/desktop/core/build-constraints.txt $(ENV_PIP) install -r $(REQUIREMENT_FILE)
@echo "--- Virtual environment setup complete for $(PYTHON_VER) ---"
@PIP_CONSTRAINT=$(ROOT)/desktop/core/build-constraints.txt PIP_BUILD_CONSTRAINT=$(ROOT)/desktop/core/build-constraints.txt $(ENV_PIP) install $(NAVOPTAPI_WHL)
@PIP_BUILD_CONSTRAINT=$(ROOT)/desktop/core/build-constraints.txt $(ENV_PIP) install $(NAVOPTAPI_WHL)
@echo "--- Finished installing $(NAVOPTAPI_WHL) into virtual-env ---"
###################################
# Build desktop
Expand Down
4 changes: 2 additions & 2 deletions desktop/core/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@ default::
env-install: $(EXT_ENV_INSTALL) compile
@echo '--- Installing $(APP_NAME) into virtual-env'
@echo '--- env-install: EXT_ENV_INSTALL: $(EXT_ENV_INSTALL)'
@echo '--- Using build constraints to prevent setuptools 82+ (cx-Oracle compatibility)'
@PIP_CONSTRAINT=$(ROOT)/desktop/core/build-constraints.txt $(ENV_PYTHON) -m pip install -e .
@echo '--- Building with setuptools < 82 in the build environment'
@PIP_BUILD_CONSTRAINT=$(ROOT)/desktop/core/build-constraints.txt $(ENV_PYTHON) -m pip install -e .
8 changes: 4 additions & 4 deletions desktop/core/base_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ celery[redis]==5.4.0
certifi==2026.10.23
cffi==2.0.0
configobj==5.0.9
cryptography==46.0.7
cryptography==50.0.2
cx-Oracle==8.3.0
Django==5.2.18
django-auth-ldap==5.3.0
Expand Down Expand Up @@ -48,9 +48,8 @@ protobuf==6.33.5
psutil==5.8.0
pyarrow==23.0.1
pydantic==2.10.6
pyformance==0.3.2
PyJWT==2.15.1
pyOpenSSL==26.0.0
pyOpenSSL==26.4.0
python-daemon==2.2.4
python-dateutil==2.8.2
python-ldap==3.4.5
Expand Down Expand Up @@ -80,9 +79,10 @@ Markdown==3.8.1
numpy==1.24.4
pandas==2.0.3
pure-sasl==0.6.2
setuptools==80.9.0
setuptools==84.1.0
sqlparse==0.6.0
-e file://${ROOT}/desktop/core/ext-py3/boto-2.49.0
-e file://${ROOT}/desktop/core/ext-py3/djangomako-1.3.2
-e file://${ROOT}/desktop/core/ext-py3/pyformance-0.3.2
-e file://${ROOT}/desktop/core/ext-py3/pysaml2-7.3.1
-e file://${ROOT}/desktop/core/ext-py3/python-sasl-0.3.1
6 changes: 4 additions & 2 deletions desktop/core/build-constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
# always builds it from source. Its setup.py imports pkg_resources, which
# setuptools removed in 82.0.0.
#
# This must be passed as PIP_BUILD_CONSTRAINT: PIP_CONSTRAINT does not apply to
# the isolated environment pip creates for build dependencies, and needs pip >= 25.3.
# This must be passed as PIP_BUILD_CONSTRAINT, which constrains only the isolated
# environment pip creates for build dependencies and needs pip >= 25.3. Do not pass
# it as PIP_CONSTRAINT: that would also constrain the setuptools the virtual env
# installs, which has to be 84.1.0 or later.
setuptools<82
13 changes: 13 additions & 0 deletions desktop/core/ext-py3/pyformance-0.3.2/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Copyright 2014 Omer Gertel

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
8 changes: 8 additions & 0 deletions desktop/core/ext-py3/pyformance-0.3.2/pyformance/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Hue: upstream line 1 was `__import__('pkg_resources').declare_namespace(__name__)`.
# pyformance is not a namespace package (setup.py declares none), and setuptools 82
# removed pkg_resources, so the line is dropped to allow setuptools >= 83 in the venv.

from .registry import MetricsRegistry, global_registry, set_global_registry
from .registry import timer, counter, meter, histogram, gauge
from .registry import dump_metrics, clear, count_calls, meter_calls, hist_calls, time_calls
from .meters.timer import call_too_long
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = "0.3.2"
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from .counter import Counter
from .meter import Meter
from .histogram import Histogram
from .timer import Timer
from .gauge import Gauge, CallbackGauge, SimpleGauge
31 changes: 31 additions & 0 deletions desktop/core/ext-py3/pyformance-0.3.2/pyformance/meters/counter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
from threading import Lock


class Counter(object):

"""
An incrementing and decrementing metric
"""

def __init__(self):
super(Counter, self).__init__()
self.lock = Lock()
self.counter = 0

def inc(self, val=1):
"increment counter by val (default is 1)"
with self.lock:
self.counter = self.counter + val

def dec(self, val=1):
"decrement counter by val (default is 1)"
self.inc(-val)

def get_count(self):
"return current value of counter"
return self.counter

def clear(self):
"reset counter to 0"
with self.lock:
self.counter = 0
57 changes: 57 additions & 0 deletions desktop/core/ext-py3/pyformance-0.3.2/pyformance/meters/gauge.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
class Gauge(object):

"""
A base class for reading of a particular.

For example, to instrument a queue depth:

class QueueLengthGaguge(Gauge):
def __init__(self, queue):
super(QueueGaguge, self).__init__()
self.queue = queue

def get_value(self):
return len(self.queue)

"""

def get_value(self):
"A subclass of Gauge should implement this method"
raise NotImplementedError()


class CallbackGauge(Gauge):

"""
A Gauge reading for a given callback
"""

def __init__(self, callback):
"constructor expects a callable"
super(CallbackGauge, self).__init__()
self.callback = callback

def get_value(self):
"returns the result of callback which is executed each time"
return self.callback()


class SimpleGauge(Gauge):

"""
A gauge which holds values with simple getter- and setter-interface
"""

def __init__(self, value=float("nan")):
"constructor accepts initial value"
super(SimpleGauge, self).__init__()
self._value = value

def get_value(self):
"getter returns current value"
return self._value

def set_value(self, value):
"setter changes current value"
# XXX: add locking?
self._value = value
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
import time
import math
from threading import Lock
from ..stats. samples import ExpDecayingSample, DEFAULT_SIZE, DEFAULT_ALPHA


class Histogram(object):

"""
A metric which calculates the distribution of a value.
"""

def __init__(self, size=DEFAULT_SIZE, alpha=DEFAULT_ALPHA, clock=time):
"""
Creates a new instance of a L{Histogram}.
"""
super(Histogram, self).__init__()
self.lock = Lock()
self.clock = clock
self.sample = ExpDecayingSample(size, alpha, clock)
self.clear()

def add(self, value):
"""
Add value to histogram

:type value: float
"""
with self.lock:
self.sample.update(value)
self.counter = self.counter + 1
self.max = value if value > self.max else self.max
self.min = value if value < self.min else self.min
self.sum = self.sum + value
self._update_var(value)

def clear(self):
"reset histogram to initial state"
with self.lock:
self.sample.clear()
self.counter = 0.0
self.max = -2147483647.0
self.min = 2147483647.0
self.sum = 0.0
self.var = [-1.0, 0.0]

def get_count(self):
"get current value of counter"
return self.counter

def get_sum(self):
"get current sum"
return self.sum

def get_max(self):
"get current maximum"
return self.max

def get_min(self):
"get current minimum"
return self.min

def get_mean(self):
"get current mean"
if self.counter > 0:
return self.sum / self.counter
return 0

def get_stddev(self):
"get current standard deviation"
if self.counter > 0:
return math.sqrt(self.get_var())
return 0

def get_var(self):
"get current variance"
if self.counter > 1:
return self.var[1] / (self.counter - 1)
return 0

def get_snapshot(self):
"get snapshot instance which holds the percentiles"
return self.sample.get_snapshot()

def _update_var(self, value):
old_m, old_s = self.var
new_m, new_s = [0.0, 0.0]
if old_m == -1:
new_m = value
else:
new_m = old_m + ((value - old_m) / self.counter)
new_s = old_s + ((value - old_m) * (value - new_m))
self.var = [new_m, new_s]
58 changes: 58 additions & 0 deletions desktop/core/ext-py3/pyformance-0.3.2/pyformance/meters/meter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import time
from threading import Lock
from ..stats.moving_average import ExpWeightedMovingAvg


class Meter(object):

"""
A meter metric which measures mean throughput and one-, five-, and fifteen-minute
exponentially-weighted moving average throughputs.
"""

def __init__(self, clock=time):
super(Meter, self).__init__()
self.lock = Lock()
self.clock = clock
self.clear()

def clear(self):
with self.lock:
self.start_time = self.clock.time()
self.counter = 0.0
self.m1rate = ExpWeightedMovingAvg(period=1, clock=self.clock)
self.m5rate = ExpWeightedMovingAvg(period=5, clock=self.clock)
self.m15rate = ExpWeightedMovingAvg(period=15, clock=self.clock)

def get_one_minute_rate(self):
return self.m1rate.get_rate()

def get_five_minute_rate(self):
return self.m5rate.get_rate()

def get_fifteen_minute_rate(self):
return self.m15rate.get_rate()

def tick(self):
self.m1rate.tick()
self.m5rate.tick()
self.m15rate.tick()

def mark(self, value=1):
with self.lock:
self.counter += value
self.m1rate.add(value)
self.m5rate.add(value)
self.m15rate.add(value)

def get_count(self):
return self.counter

def get_mean_rate(self):
if self.counter == 0:
return 0
elapsed = self.clock.time() - self.start_time
return self.counter / elapsed

def _convertNsRate(self, ratePerNs):
return ratePerNs
Loading
Loading