本文整理汇总了Python中sys.api_version方法的典型用法代码示例。如果您正苦于以下问题:Python sys.api_version方法的具体用法?Python sys.api_version怎么用?Python sys.api_version使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sys
的用法示例。
在下文中一共展示了sys.api_version方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: initialize
# 需要导入模块: import sys [as 别名]
# 或者: from sys import api_version [as 别名]
def initialize():
'''Initializes FIRST by installing hooks and populating required data
strucutres.'''
global g_network_headers
g_network_headers['User-Agent'] = "FIRST {} {} Cython {}({}.{}.{}) {}".format(
FIRST.VERSION,
FIRST.DATE,
sys.api_version,
sys.version_info.major,
sys.version_info.minor,
sys.version_info.releaselevel,
sys.platform
)
FIRST.installed_hooks = [FIRST.Hook.IDP(), FIRST.Hook.UI()]
[x.hook() for x in FIRST.installed_hooks]
FIRST.plugin = FIRST_FormClass()
示例2: test_attributes
# 需要导入模块: import sys [as 别名]
# 或者: from sys import api_version [as 别名]
def test_attributes(self):
if not test.test_support.is_jython:
self.assert_(isinstance(sys.api_version, int))
self.assert_(isinstance(sys.argv, list))
self.assert_(sys.byteorder in ("little", "big"))
self.assert_(isinstance(sys.builtin_module_names, tuple))
self.assert_(isinstance(sys.copyright, basestring))
self.assert_(isinstance(sys.exec_prefix, basestring))
self.assert_(isinstance(sys.executable, basestring))
self.assert_(isinstance(sys.hexversion, int))
self.assert_(isinstance(sys.maxint, int))
self.assert_(isinstance(sys.maxunicode, int))
self.assert_(isinstance(sys.platform, basestring))
self.assert_(isinstance(sys.prefix, basestring))
self.assert_(isinstance(sys.version, basestring))
vi = sys.version_info
self.assert_(isinstance(vi, tuple))
self.assertEqual(len(vi), 5)
self.assert_(isinstance(vi[0], int))
self.assert_(isinstance(vi[1], int))
self.assert_(isinstance(vi[2], int))
self.assert_(vi[3] in ("alpha", "beta", "candidate", "final"))
self.assert_(isinstance(vi[4], int))
示例3: create_cluster
# 需要导入模块: import sys [as 别名]
# 或者: from sys import api_version [as 别名]
def create_cluster(resource_root, name, version=None, fullVersion=None):
"""
Create a cluster
@param resource_root: The root Resource object.
@param name: Cluster name
@param version: Cluster CDH major version (eg: "CDH4")
- The CDH minor version will be assumed to be the
latest released version for CDH4, or 5.0 for CDH5.
@param fullVersion: Cluster's full CDH version. (eg: "5.1.1")
- If specified, 'version' will be ignored.
- Since: v6
@return: An ApiCluster object
"""
if version is None and fullVersion is None:
raise Exception("Either 'version' or 'fullVersion' must be specified")
if fullVersion is not None:
api_version = 6
version = None
else:
api_version = 1
apicluster = ApiCluster(resource_root, name, version, fullVersion)
return call(resource_root.post, CLUSTERS_PATH, ApiCluster, True,
data=[apicluster], api_version=api_version)[0]
示例4: configure_for_kerberos
# 需要导入模块: import sys [as 别名]
# 或者: from sys import api_version [as 别名]
def configure_for_kerberos(self, datanode_transceiver_port=None,
datanode_web_port=None):
"""
Command to configure the cluster to use Kerberos for authentication.
This command will configure all relevant services on a cluster for
Kerberos usage. This command will trigger a GenerateCredentials command
to create Kerberos keytabs for all roles in the cluster.
@param datanode_transceiver_port: The HDFS DataNode transceiver port to use.
This will be applied to all DataNode role configuration groups. If
not specified, this will default to 1004.
@param datanode_web_port: The HDFS DataNode web port to use. This will be
applied to all DataNode role configuration groups. If not specified,
this will default to 1006.
@return: Reference to the submitted command.
@since: API v11
"""
args = dict()
if datanode_transceiver_port:
args['datanodeTransceiverPort'] = datanode_transceiver_port
if datanode_web_port:
args['datanodeWebPort'] = datanode_web_port
return self._cmd('configureForKerberos', data=args, api_version=11)
示例5: test_api_version
# 需要导入模块: import sys [as 别名]
# 或者: from sys import api_version [as 别名]
def test_api_version(self):
# api_version
self.assertEqual(sys.api_version, 0)
示例6: list_hosts
# 需要导入模块: import sys [as 别名]
# 或者: from sys import api_version [as 别名]
def list_hosts(self):
"""
Lists all the hosts that are associated with this cluster.
@return: A list of ApiHostRef objects of the hosts in the cluster.
@since: API v3
"""
return self._get("hosts", ApiHostRef, True, api_version=3)
示例7: remove_host
# 需要导入模块: import sys [as 别名]
# 或者: from sys import api_version [as 别名]
def remove_host(self, hostId):
"""
Removes the association of the host with the cluster.
@return: A ApiHostRef of the host that was removed.
@since: API v3
"""
return self._delete("hosts/" + hostId, ApiHostRef, api_version=3)
示例8: remove_all_hosts
# 需要导入模块: import sys [as 别名]
# 或者: from sys import api_version [as 别名]
def remove_all_hosts(self):
"""
Removes the association of all the hosts with the cluster.
@return: A list of ApiHostRef objects of the hosts that were removed.
@since: API v3
"""
return self._delete("hosts", ApiHostRef, True, api_version=3)
示例9: add_hosts
# 需要导入模块: import sys [as 别名]
# 或者: from sys import api_version [as 别名]
def add_hosts(self, hostIds):
"""
Adds a host to the cluster.
@param hostIds: List of IDs of hosts to add to cluster.
@return: A list of ApiHostRef objects of the new
hosts that were added to the cluster
@since: API v3
"""
hostRefList = [ApiHostRef(self._get_resource_root(), x) for x in hostIds]
return self._post("hosts", ApiHostRef, True, data=hostRefList,
api_version=3)
示例10: deploy_cluster_client_config
# 需要导入模块: import sys [as 别名]
# 或者: from sys import api_version [as 别名]
def deploy_cluster_client_config(self, hostIds=[]):
"""
Deploys Cluster client configuration (Kerberos configuration) to the
hosts on the cluster. Any hosts that are decommissioned or have running
roles will be skipped.
@param hostIds: hostIds of hosts to deploy to. If empty, deploys to all
hosts in the cluster.
@return: Reference to the submitted command.
@since: API v7
"""
return self._cmd('deployClusterClientConfig', data=hostIds,
api_version=7)
示例11: auto_assign_roles
# 需要导入模块: import sys [as 别名]
# 或者: from sys import api_version [as 别名]
def auto_assign_roles(self):
"""
Automatically assign roles to hosts and create the roles for all the services in a cluster.
Assignments are done based on services in the cluster and hardware specifications.
Existing roles will be taken into account and their assignments will be not be modified.
@since: API v6
"""
self._put("autoAssignRoles", None, api_version=6)
示例12: auto_configure
# 需要导入模块: import sys [as 别名]
# 或者: from sys import api_version [as 别名]
def auto_configure(self):
"""
Automatically configures roles and services in a cluster.
Overwrites some existing configurations. Might create new role config
groups. Only default role config groups must exist before calling this
endpoint. Other role config groups must not exist. If they do, an exception
will be thrown preventing any configuration. Ignores the Cloudera
Management Service even if colocated with roles of this cluster. To avoid
over-committing the heap on hosts, assign hosts to this cluster that are
not being used by the Cloudera Management Service.
@since: API v6
"""
self._put("autoConfigure", None, api_version=6)
示例13: export
# 需要导入模块: import sys [as 别名]
# 或者: from sys import api_version [as 别名]
def export(self, export_auto_config=False):
"""
Export the cluster template for the given cluster. ccluster must have host
templates defined. It cluster does not have host templates defined it will
export host templates based on roles assignment.
@param export_auto_config: Also export auto configured configs
@return: Return cluster template
@since: API v12
"""
return self._get("export", ApiClusterTemplate, False,
params=dict(exportAutoConfig=export_auto_config), api_version=12)
示例14: pools_refresh
# 需要导入模块: import sys [as 别名]
# 或者: from sys import api_version [as 别名]
def pools_refresh(self):
"""
Refresh Dynamic Pools configurations for relevant services..
@return: Reference to the submitted command.
@since: API v6
"""
return self._cmd('poolsRefresh', api_version=6)
示例15: test_indexer_records_import_of_multiple_aliased_variables_with_single_import_statement
# 需要导入模块: import sys [as 别名]
# 或者: from sys import api_version [as 别名]
def test_indexer_records_import_of_multiple_aliased_variables_with_single_import_statement(self):
client = self.indexSourceCode(
'from sys import float_info as FI, api_version as AI\n'
)
self.assertTrue('USAGE: virtual_file -> sys at [1:6|1:8]' in client.references)
self.assertTrue('IMPORT: virtual_file -> sys.float_info at [1:17|1:26]' in client.references)
self.assertTrue('IMPORT: virtual_file -> sys.float_info at [1:31|1:32]' in client.references)
self.assertTrue('IMPORT: virtual_file -> sys.api_version at [1:35|1:45]' in client.references)
self.assertTrue('IMPORT: virtual_file -> sys.api_version at [1:50|1:51]' in client.references)