<commit_before>#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
from math import ceil
from simfrastructure_core import *

verbose=0
current_server_index=1

def gererate_png(sim_object, type, graph_attributes):
  if type == "twopi":
    graph = Digraph(name=sim_object.name, format='png', engine='twopi', graph_attr=graph_attributes)
  else:
    graph = Digraph(name=sim_object.name, format='png', graph_attr=graph_attributes)
  graph = sim_object.generate_graph(graph)
  print(graph)
  graph.render()

def create_tenant_in_dc(tenant_id, tiers, x, dc):
  """Client with X microservice applications"""
  tenant_name = "client"+str(tenant_id)
  modules = []
  containers_to_host= []
  vms_to_host = []
  global current_server_index

  """Create containers and VMs"""
  for i in range(1, x+1):
    module_name = "module"+str(i)
    modules.append(module_name)
    for k, v in tiers.items():
      if v[1] == "one_per_module":
        if v[0] == "containers":
          cont = sim_container(tenant_name+"_"+module_name+"_"+k, v[2], v[3], tenant_id)
          containers_to_host.append(cont)
        elif v[0] == "vms": 
          vm = sim_vm(tenant_name+"_"+module_name+"_"+k, v[2], v[3], tenant_id)
          vms_to_host.append(vm)
  for k, v in tiers.items():
    if v[1] == "unique":
      if v[0] == "vms":
        vm = sim_vm(tenant_name+"_"+k, v[2], v[3], tenant_id)
        vms_to_host.append(vm)
      elif v[1] == "containers":
      cont = sim_container(tenant_name+"_"+k, v[2], v[3], tenant_id)
      containers_to_host.append(cont)     

  """Get containers and vms total footprint"""
  containers_total_vcpu = 0
  containers_total_ram = 0
  for container in containers_to_host:
    containers_total_vcpu += container.capacity["vcpu"]
    containers_total_ram += container.capacity["ram"]
  if verbose:
    print("Container footprint: "+str(containers_total_vcpu)+" vCPU/"+str(containers_total_ram)+" GB RAM")<commit_msg>wrong indent<commit_after>#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
from math import ceil
from simfrastructure_core import *

verbose=0
current_server_index=1

def gererate_png(sim_object, type, graph_attributes):
  if type == "twopi":
    graph = Digraph(name=sim_object.name, format='png', engine='twopi', graph_attr=graph_attributes)
  else:
    graph = Digraph(name=sim_object.name, format='png', graph_attr=graph_attributes)
  graph = sim_object.generate_graph(graph)
  print(graph)
  graph.render()

def create_tenant_in_dc(tenant_id, tiers, x, dc):
  """Client with X microservice applications"""
  tenant_name = "client"+str(tenant_id)
  modules = []
  containers_to_host= []
  vms_to_host = []
  global current_server_index

  """Create containers and VMs"""
  for i in range(1, x+1):
    module_name = "module"+str(i)
    modules.append(module_name)
    for k, v in tiers.items():
      if v[1] == "one_per_module":
        if v[0] == "containers":
          cont = sim_container(tenant_name+"_"+module_name+"_"+k, v[2], v[3], tenant_id)
          containers_to_host.append(cont)
        elif v[0] == "vms": 
          vm = sim_vm(tenant_name+"_"+module_name+"_"+k, v[2], v[3], tenant_id)
          vms_to_host.append(vm)
  for k, v in tiers.items():
    if v[1] == "unique":
      if v[0] == "vms":
        vm = sim_vm(tenant_name+"_"+k, v[2], v[3], tenant_id)
        vms_to_host.append(vm)
      elif v[1] == "containers":
        cont = sim_container(tenant_name+"_"+k, v[2], v[3], tenant_id)
        containers_to_host.append(cont)     

  """Get containers and vms total footprint"""
  containers_total_vcpu = 0
  containers_total_ram = 0
  for container in containers_to_host:
    containers_total_vcpu += container.capacity["vcpu"]
    containers_total_ram += container.capacity["ram"]
  if verbose:
    print("Container footprint: "+str(containers_total_vcpu)+" vCPU/"+str(containers_total_ram)+" GB RAM")
{'fraction_non_alphanumeric': 0.14636669252650633, 'fraction_numerical': 0.010861132660977503, 'mean_word_length': 4.06282722513089, 'pattern_counts': {'":': 14, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1259499', 'n_tokens_mistral': 1385, 'n_tokens_neox': 1393, 'n_words': 284}