Hello tutors,

here i am trying to create a cluster on cloud using json data but its
giving some error
can you walk me through it. thankyou


import urllib2
import requests
data="""{
  "spark_version": null,
  "presto_version": null,
  "label": [
    "test"
  ],
  "disallow_cluster_termination": false,
  "force_tunnel": false,
  "enable_ganglia_monitoring": false,
  "node_bootstrap_file": null,
  "tunnel_server_ip": null,
  "ec2_settings": {
    "aws_preferred_availability_zone": "Any",
    "aws_region": "us-east-1",
    "compute_validated": false,
    "vpc_id": null,
    "subnet_id": null,
    "bastion_node_public_dns": null,
    "master_elastic_ip": null,
    "instance_tenancy": null,
    "compute_secret_key": "",
    "compute_access_key": "AKIAITFMYWE7A3BG5BDQ",
    "use_account_compute_creds": true
  },
  "hadoop_settings": {
    "use_hbase": null,
    "use_spark": false,
    "custom_config": null,
    "use_hadoop2": false,
    "use_qubole_placement_policy": true,
    "is_ha": null,
    "enable_rubix": false,
    "fairscheduler_settings": {
      "default_pool": null
    }
  },
  "node_configuration": {
    "master_instance_type": "m1.large",
    "slave_instance_type": "m1.xlarge",
    "initial_nodes": 1,
    "max_nodes": 1,
    "idle_cluster_timeout": null,
    "slave_request_type": "spot",
    "fallback_to_ondemand": null,
    "spot_instance_settings": {
      "maximum_bid_price_percentage": 100,
      "timeout_for_request": 10,
      "maximum_spot_instance_percentage": 50
    },
    "cluster_name": "qa_qbol_acc5572_cl67507"
  },
  "security_settings": {
    "encrypted_ephemerals": false
  },
  "presto_settings": {
    "enable_presto": false,
    "custom_config": null
  },
  "spark_settings": {
    "custom_config": null
  },
  "errors": [
    "invalid_credentials"
  ],
  "datadog_settings": {
    "datadog_api_token": null,
    "datadog_app_token": null
  },
  "spark_s3_package_name": null,
  "zeppelin_s3_package_name": null,
  "engine_config": {},
  "zeppelin_interpreter_mode": null
}"""
u='auth_token'
p='d3d62d04584d49bbaf2a2430a453f3314fb03b38adcd4e58ac671f40638ac6cd'
url='https://qa.qubole.net/api/v1.3/clusters'
print url
headers={'u':'p'}
req = requests.post(url, data,headers)
#base64string = base64.encodestring('%s:%s' % (u, p)).replace('\n', '')
#req.add_header("Authorization", "Basic %s" %base64string)
for line in req:
print line
#f.close()











Output:


https://qubole.net/api/v1.3/clusters
Traceback (most recent call last):
  File "createCluster.py", line 83, in <module>
    f = urllib2.urlopen(req)
  File "/usr/lib/python2.7/urllib2.py", line 154, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/lib/python2.7/urllib2.py", line 431, in open
    response = self._open(req, data)
  File "/usr/lib/python2.7/urllib2.py", line 449, in _open
    '_open', req)
  File "/usr/lib/python2.7/urllib2.py", line 409, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 1240, in https_open
    context=self._context)
  File "/usr/lib/python2.7/urllib2.py", line 1197, in do_open
    raise URLError(err)
urllib2.URLError: <urlopen error [Errno 111] Connection refused>
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to