|
|
@@ -432,16 +432,21 @@ def get_api(request, snippet):
|
|
|
connector_name = snippet['type']
|
|
|
|
|
|
if has_connectors() and snippet.get('type') == 'hello' and is_admin(request.user):
|
|
|
+ LOG.debug('Using the interpreter from snippet')
|
|
|
interpreter = snippet.get('interpreter')
|
|
|
- else:
|
|
|
+ elif get_cluster_config(request.user).get('has_computes'):
|
|
|
+ if snippet.get('type') in ('hive-compute', 'impala-compute') and snippet.get('id'):
|
|
|
+ LOG.debug("Loading the compute from db using snippet['id']: %" % snippet['id'])
|
|
|
+ interpreter = Compute.objects.get(id=snippet['id']).to_dict()
|
|
|
if snippet.get('compute'):
|
|
|
+ LOG.debug("Using the compute as is from snippet['compute']")
|
|
|
interpreter = snippet['compute']
|
|
|
- elif snippet.get('connector'):
|
|
|
- interpreter = snippet['connector']
|
|
|
- elif snippet.get('type') in ('hive-compute', 'impala-compute'):
|
|
|
- interpreter = Compute.objects.get(id=snippet['id']).to_dict()
|
|
|
- else:
|
|
|
- interpreter = get_interpreter(connector_type=connector_name, user=request.user)
|
|
|
+ elif has_connectors() and snippet.get('connector'):
|
|
|
+ LOG.debug("Connectors are enabled and picking the connector from snippet['connector']")
|
|
|
+ interpreter = snippet['connector']
|
|
|
+ else:
|
|
|
+ LOG.debug("Picking up the connectors from the configs using connector_name: %s" % connector_name)
|
|
|
+ interpreter = get_interpreter(connector_type=connector_name, user=request.user)
|
|
|
|
|
|
interface = interpreter['interface']
|
|
|
|