<commit_before>#!/usr/bin/env python3
###############################################################################
# Name        : aws_ec2_eod.py                                                #
# Author      : <NAME>                                                  #
# Version     : v. 1.0.0.0                                                    #
# Description :                                                               #
###############################################################################
import boto3, os, sys, logging;

class AWSService:
	params=None;client=None;debug=None;force=None;logger=None;service=None;region=None;
	def __init__(self, params=dict()):
		logging.basicConfig(format="%(asctime)s %(levelname)s  %(message)s", level="INFO");
		self.logger            = logging.getLogger(__name__);
		self.params            = params;
		self.ignored_instances = params["--ignored"].split(",") if "--ignored" in params.keys() else list();
		self.service           = params["-s"] if "-s" in params.keys() else "ec2";
		self.region            = params["-r"] if "-r" in params.keys() else "us-east-1";
		self.client            = boto3.client(self.service, self.region);
	def invoke(self):
		instances = self.client.describe_hosts();
		for instance in instances["Hosts"]:
			if instance["State"] != "Terminated" and instance["Name"] not in self.ignored_instances:
				print(instance["InstanceId"]);
				if not self.debug: self.client.terminate_instance(instance["InstanceId"]);
	pass;

if __name__ == "__main__":
	params = dict();
	for i in range(0, len(sys.argv) - 1): params[sys.argv[i]] = sys.argv[i + 1];
	session = AWSService(params);
	session.invoke();
<commit_msg>Update aws_ec2_eod.py<commit_after>#!/usr/bin/env python3
###############################################################################
# Name        : aws_ec2_eod.py                                                #
# Author      : <NAME>                                                  #
# Version     : v. 1.0.0.0                                                    #
# Description :                                                               #
###############################################################################
import boto3, os, sys, logging;

class AWSService:
	params=None;client=None;debug=None;force=None;logger=None;service=None;region=None;ignored_instances=None;
	def __init__(self, params=dict()):
		logging.basicConfig(format="%(asctime)s %(levelname)s  %(message)s", level="INFO");
		self.logger            = logging.getLogger(__name__);
		self.params            = params;
		self.ignored_instances = params["--ignored"].split(",") if "--ignored" in params.keys() else list();
		self.service           = params["-s"] if "-s" in params.keys() else "ec2";
		self.region            = params["-r"] if "-r" in params.keys() else "us-east-1";
		self.client            = boto3.client(self.service, self.region);
	def invoke(self):
		instances = self.client.describe_hosts();
		for instance in instances["Hosts"]:
			if instance["State"] != "Terminated" and instance["Name"] not in self.ignored_instances:
				print(instance["InstanceId"]);
				if not self.debug: self.client.terminate_instance(instance["InstanceId"]);
	pass;

if __name__ == "__main__":
	params = dict();
	for i in range(0, len(sys.argv) - 1): params[sys.argv[i]] = sys.argv[i + 1];
	session = AWSService(params);
	session.invoke();

{'fraction_non_alphanumeric': 0.2292825768667643, 'fraction_numerical': 0.007906295754026354, 'mean_word_length': 2.5035897435897434, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 16, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1829465', 'n_tokens_mistral': 1002, 'n_tokens_neox': 948, 'n_words': 191}