Class: Outhad::Integrations::Source::DatabricksModel::Client
- Inherits:
-
SourceConnector
- Object
- SourceConnector
- Outhad::Integrations::Source::DatabricksModel::Client
- Defined in:
- lib/outhad/integrations/source/databrics_model/client.rb
Instance Method Summary collapse
- #check_connection(connection_config) ⇒ Object
- #discover(_connection_config = nil) ⇒ Object
- #read(sync_config) ⇒ Object
Instance Method Details
#check_connection(connection_config) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/outhad/integrations/source/databrics_model/client.rb', line 7 def check_connection(connection_config) connection_config = connection_config.with_indifferent_access url = build_url(DATABRICKS_HEALTH_URL, connection_config) response = Outhad::Integrations::Core::HttpClient.request( url, HTTP_GET, headers: auth_headers(connection_config[:token]) ) if success?(response) success_status else failure_status(nil) end rescue StandardError => e ConnectionStatus.new(status: ConnectionStatusType["failed"], message: e.). end |
#discover(_connection_config = nil) ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/outhad/integrations/source/databrics_model/client.rb', line 24 def discover(_connection_config = nil) catalog_json = read_json(CATALOG_SPEC_PATH) catalog = build_catalog(catalog_json) catalog. rescue StandardError => e handle_exception(e, { context: "DATABRICKS MODEL:DISCOVER:EXCEPTION", type: "error" }) end |
#read(sync_config) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/outhad/integrations/source/databrics_model/client.rb', line 35 def read(sync_config) connection_config = sync_config.source.connection_specification connection_config = connection_config.with_indifferent_access # The server checks the ConnectorQueryType. # If it's "ai_ml," the server calculates the payload and passes it as a query in the sync config model protocol. # This query is then sent to the AI/ML model. payload = JSON.parse(sync_config.model.query) run_model(connection_config, payload) rescue StandardError => e handle_exception(e, { context: "DATABRICKS MODEL:READ:EXCEPTION", type: "error" }) end |