def get_elapsed_time(self): return_value = {} self.tiempo_final = time_i() tiempo_ejecucion = self.tiempo_final - self.tiempo_inicial # print("Tardó: " , tiempo_ejecucion,"s") return_value["seconds"] = tiempo_ejecucion return_value["string"] = self.seconds_timestamp(tiempo_ejecucion) return return_value
def display_times_end(tiempo_inicial): tiempo_final = time_i() tiempo_ejecucion = tiempo_final - tiempo_inicial print("Tardó: ", tiempo_ejecucion, "s") m, s = divmod(tiempo_ejecucion, 60) h, m = divmod(m, 60) restore_time = "%02d:%02d:%02d" % (h, m, s) print("Tardó:", restore_time)
def ftp_download(item, conf): """ Download media by FTP """ tiempo_inicial = time_i() ftp = FTP(conf["origin_ftp_server"]["host"]) print( ftp.login(conf["origin_ftp_server"]["user"], conf["origin_ftp_server"]["pass"])) print(ftp.pwd()) # ftp.retrlines('LIST') ftp.cwd(item["folder"]) print("Descargando: " + item["clip"]) try: ftp.retrbinary('RETR ' + item["clip"], open(item["clip"], 'wb').write) download_success = True except all_errors as e: print(e) ftp.quit() tiempo_final = time_i() tiempo_ejecucion = tiempo_final - tiempo_inicial print("Tardó: ", tiempo_ejecucion, "s") print(seconds_timestamp(tiempo_ejecucion)) return tiempo_ejecucion
def suma_sizes_clean_list(lista_limpia, path_to_inspect): ## path_to_inspect es la carpeta sobre la que se quiere actuar tiempo_inicial1 = time_i() line_counter = 0 sumatoria = 0 for item in lista_limpia: line_counter += 1 # print(str(line_counter)+" "+item) ###### Extraer el peso ######## if (item == lista_limpia[0]): # print("cabezal") pass elif (path_to_inspect in item): # print("SUMAR") size = get_size_bytes(item) sumatoria += size else: # print("---ITEM---",item) path_to_inspect_size = get_size_bytes(item) print("############### TIEMPOS SUMATORIA ######################") display_times_end(tiempo_inicial1) return sumatoria
import time from datetime import datetime from time import time as time_i tiempo_inicial = time_i() tiempo_final = time_i() tiempo_ejecucion = tiempo_final - tiempo_inicial print("Tardó: ", tiempo_ejecucion, "s") m, s = divmod(tiempo_ejecucion, 60) h, m = divmod(m, 60) restore_time = "%02d:%02d:%02d" % (h, m, s) print("Tardó:", restore_time)
return score_files def display_times_end(tiempo_inicial): tiempo_final = time_i() tiempo_ejecucion = tiempo_final - tiempo_inicial print("Tardó: ", tiempo_ejecucion, "s") m, s = divmod(tiempo_ejecucion, 60) h, m = divmod(m, 60) restore_time = "%02d:%02d:%02d" % (h, m, s) print("Tardó:", restore_time) #### Fin de Funciones tiempo_inicial = time_i() ### Get lista de reportes ### path_mm = "C:\\Users\\ennima\\Documents\\Develops 2018\\Milenio\\M_2018_Dash_data_vxv\\" score_files = get_lista_reportes(path_mm, "in") ## Simplificar los reportes print("\n\n################# SCORES: ###########################") print(score_files) print("\n\n\n\n\n") ## Select Scores score_curr = len(score_files) - 1 current_report = abre_reporte(score_files[score_curr]) # print("Total of lines: ",len(current_report)) week_work = {"begin": 1, "end": 3}
def init(self): self.tiempo_inicial = time_i()
api_server = conf["istorage_api_servers"][0] tipo_ingesta = get_ingest_client_type(ingest_client_types) empresa = get_empresa_alias(empresas)['alias'] # print(empresa) ip = socket.gethostbyname(socket.gethostname()) # to get physical address: original_mac_address = getnode() # print("MAC Address: " + str(original_mac_address)) # this output is in raw format hex_mac_address = str("".join( re.findall('..', '%012x' % original_mac_address))) # print("HEX MAC Address: " + hex_mac_address) client_name = empresa + "_" + tipo_ingesta[:3] + "-" + ip.replace( ".", "") + "-" + hex_mac_address + "-" + str(time_i()) print(client_name) print(len(client_name)) ingest_client_ins = IngestClient() ingest_client_ins.set_api_server(api_server) ingest_client_ins.add(client_name, tipo_ingesta) client = {"name": client_name, "type": tipo_ingesta} conf["client"] = client with open(conf_file, 'w') as cnf: json.dump(conf, cnf)