Class: GoodData::Bricks::ExecutionResultMiddleware

Inherits:
Middleware show all
Defined in:
lib/gooddata/bricks/middleware/execution_result_middleware.rb

Constant Summary collapse

@@result_log_path =
nil

Instance Attribute Summary

Attributes inherited from Middleware

#app

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Middleware

#initialize, #load_defaults

Methods included from Utils

#returning

Constructor Details

This class inherits a constructor from GoodData::Bricks::Middleware

Class Method Details

.update_execution_result(status, message = "") ⇒ Object

Update process execution result when the script is executed inside a GDC ETL process execution (ruby bricks). Ruby bricks should update execution result at the end of script with status=WARNING or OK and summary message if the script exits normally. If any fatal error, script should update execution result with status=ERROR and error message, then throw exception to notify GDC platform that the script terminated unexpectedly.

Parameters:

  • params (HashMap)

    contains GDC_EXECUTION_RESULT_LOG_PATH or GDC_LOG_DIRECTORY, GDC_EXECUTION_ID

  • status (ExecutionStatus)

    execution status

  • message (String) (defaults to: "")

    execution message



31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/gooddata/bricks/middleware/execution_result_middleware.rb', line 31

def self.update_execution_result(status, message = "")
  if status != ExecutionStatus::OK && status != ExecutionStatus::ERROR && status != ExecutionStatus::WARNING
    GoodData.logger.warn("Unknown execution status #{status}, ignored it.")
  end

  result = {
    executionResult: {
      status: status,
      message: message
    }
  }
  update_result(result, status)
end

Instance Method Details

#call(params) ⇒ Object



19
20
21
22
# File 'lib/gooddata/bricks/middleware/execution_result_middleware.rb', line 19

def call(params)
  result_log_path(params)
  @app.call(params)
end