Skip to content

Instantly share code, notes, and snippets.

View alculquicondor's full-sized avatar
🎯
Focusing

Aldo Culquicondor alculquicondor

🎯
Focusing
View GitHub Profile
# Original: zones: 14, 12
>>> main.topology_spreading([[4, 4, 3, 3], [5, 3, 2, 2]], None)
[[72, 72, 81, 81], [72, 90, 100, 100]]
## zones: 6, 4
>>> main.topology_spreading([[2, 2, 1, 1], [3, 1, 0, 0]], None)
[[40, 40, 60, 60], [40, 80, 100, 100]]
def least_resources(new_per_zone, existing_per_zone):
# assume a weight of 1 per pod, max 100 pods per node
scores = []
for i in range(len(new_per_zone)):
zone_scores = []
for j in range(len(new_per_zone[i])):
pods = new_per_zone[i][j] + existing_per_zone[i][j]
zone_scores.append(max(100-pods, 0))
scores.append(zone_scores)
return scores
{
"version": "v1",
"dataItems": [
{
"data": {
"Average": 333.3333333333333,
"Perc50": 413,
"Perc90": 445,
"Perc99": 445
},
{
"version": "v1",
"dataItems": [
{
"data": {
"Average": 792,
"Perc50": 792,
"Perc90": 792,
"Perc99": 792
},
{
"version": "v1",
"dataItems": [
{
"data": {
"Average": 909,
"Perc50": 909,
"Perc90": 909,
"Perc99": 909
},
# models.py
class Subscription(models.Model):
pass
class User(models.Model):
subscription = models.ForeignKey(Subscription, null=True,
blank=True, related_name='users',
on_delete=models.SET_NULL)
This file has been truncated, but you can view the full file.
0000000000fed440 d a_attrs
U access@@GLIBC_2.2.5
U acos@@GLIBC_2.2.5
0000000000feee40 d action_attr
000000000071cca0 T adler32
000000000071cfe0 T adler32_combine
000000000071d0e0 T adler32_combine64
0000000000feec90 d align_attr
00000000011b6240 d allowPCData
00000000011b5d00 d alpha_lower_list
import libvirt
import signal
import sys
import time
stats = []
def signal_handler(signal, frame):
for stat in stats:
print(",".join("%.2f" % x for x in stat))
<domain type='kvm' id='5'>
<name>archlinux</name>
<uuid>5fdc8598-7a07-460f-9d40-16e6554adbe0</uuid>
<memory unit='KiB'>1048576</memory>
<currentMemory unit='KiB'>1048576</currentMemory>
<vcpu placement='static'>2</vcpu>
<resource>
<partition>/machine</partition>
</resource>
<os>
#!/usr/bin/env python3
import argparse
import collections
import os
import string
import multiprocessing
import time
BUFFER_SIZE = 20 << 20 # 20MB