from typing import Dict, List
import teuthology.dispatcher.supervisor as supervisor
+import teuthology.exporter as exporter
import teuthology.lock.ops as lock_ops
import teuthology.nuke as nuke
import teuthology.worker as worker
def lock_machines(job_config):
report.try_push_job_info(job_config, dict(status='running'))
fake_ctx = supervisor.create_fake_context(job_config, block=True)
- lock_ops.block_and_lock_machines(
- fake_ctx,
- len(job_config['roles']),
- job_config['machine_type'],
- tries=-1,
- reimage=False,
- )
+ machine_type = job_config["machine_type"]
+ count = len(job_config['roles'])
+ with exporter.NodeLockingTime.labels(machine_type, count).time():
+ lock_ops.block_and_lock_machines(
+ fake_ctx,
+ count,
+ machine_type,
+ tries=-1,
+ reimage=False,
+ )
job_config = fake_ctx.config
return job_config
start_http_server,
Gauge,
Counter,
+ Summary,
multiprocess,
CollectorRegistry,
)
def update(self):
for machine_type in MACHINE_TYPES:
- queue_stats = beanstalk.stats_tube(
- beanstalk.connect(), machine_type
- )
+ queue_stats = beanstalk.stats_tube(beanstalk.connect(), machine_type)
self.length.labels(machine_type).set(queue_stats["count"])
self.paused.labels(machine_type).set(1 if queue_stats["paused"] else 0)
self.metric.labels(machine_type=machine_type, status=status).inc()
+NodeLockingTime = Summary(
+ "teuthology_node_locking_duration_seconds",
+ "Time spent waiting to lock a node",
+ ["machine_type", "count"],
+)
+
+
def main(args):
exporter = TeuthologyExporter(interval=int(args["--interval"]))
exporter.start()