<commit_before>(ns circle.backend.load-balancer
  (:import com.amazonaws.services.elasticloadbalancing.AmazonElasticLoadBalancingClient
           com.amazonaws.services.ec2.AmazonEC2Client
           (com.amazonaws.services.elasticloadbalancing.model
            ConfigureHealthCheckRequest
            CreateLoadBalancerRequest
            DeleteLoadBalancerRequest
            DeregisterInstancesFromLoadBalancerRequest
            DescribeInstanceHealthRequest
            DescribeLoadBalancersRequest
            EnableAvailabilityZonesForLoadBalancerRequest
            HealthCheck
            Instance
            Listener
            RegisterInstancesWithLoadBalancerRequest))
  (:use [circle.aws-credentials :only (aws-credentials)])
  (:use [pallet.thread-expr :only (when->)])
  (:use [circle.utils.except :only (throw-if-not)])
  (:use [circle.utils.core :only (apply-map)]))

(defmacro with-elb-client
  [client & body]
  `(let [~client (AmazonElasticLoadBalancingClient. aws-credentials)]
     ~@body))

(defn delete-balancer
  "name is the name passed to create-balancer. Returns nil"
  [name]
  (with-elb-client client
    (.deleteLoadBalancer client (DeleteLoadBalancerRequest. name))))

(defn add-instances
  "Instances is a seq of strings, each an EC2 instance id"
  [lb-name instances]
  (with-elb-client client<commit_msg>Sigh.<commit_after>(ns circle.backend.load-balancer
  (:import com.amazonaws.services.elasticloadbalancing.AmazonElasticLoadBalancingClient
           com.amazonaws.services.ec2.AmazonEC2Client
           (com.amazonaws.services.elasticloadbalancing.model
            ConfigureHealthCheckRequest
            CreateLoadBalancerRequest
            DeleteLoadBalancerRequest
            DeregisterInstancesFromLoadBalancerRequest
            DescribeInstanceHealthRequest
            DescribeLoadBalancersRequest
            EnableAvailabilityZonesForLoadBalancerRequest
            HealthCheck
            Instance
            Listener
            RegisterInstancesWithLoadBalancerRequest))
  (:use [circle.aws-credentials :only (aws-credentials)])
  (:use [clojure.tools.logging :only (infof)])
  (:use [pallet.thread-expr :only (when->)])
  (:use [circle.utils.except :only (throw-if-not)])
  (:use [circle.utils.core :only (apply-map)]))

(defmacro with-elb-client
  [client & body]
  `(let [~client (AmazonElasticLoadBalancingClient. aws-credentials)]
     ~@body))

(defn delete-balancer
  "name is the name passed to create-balancer. Returns nil"
  [name]
  (with-elb-client client
    (.deleteLoadBalancer client (DeleteLoadBalancerRequest. name))))

(defn add-instances
  "Instances is a seq of strings, each an EC2 instance id"
  [lb-name instances]
  (with-elb-client client
{'fraction_non_alphanumeric': 0.09211009174311927, 'fraction_numerical': 0.0022018348623853213, 'mean_word_length': 3.2996845425867507, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '1196105', 'n_tokens_mistral': 794, 'n_tokens_neox': 774, 'n_words': 157}