Class: Barbeque::ExecutionLog
- Inherits:
-
Object
- Object
- Barbeque::ExecutionLog
- Defined in:
- lib/barbeque/execution_log.rb
Constant Summary collapse
- DEFAULT_S3_BUCKET_NAME =
'barbeque'
Class Method Summary collapse
Instance Method Summary collapse
-
#load(execution:) ⇒ Hash
Log.
- #save_message(execution, message) ⇒ Object
- #save_stdout_and_stderr(execution, stdout, stderr) ⇒ Object
- #try_save_stdout_and_stderr(execution, stdout, stderr) ⇒ Object
Class Method Details
.s3_client ⇒ Object
13 14 15 |
# File 'lib/barbeque/execution_log.rb', line 13 def s3_client @s3_client ||= Aws::S3::Client.new end |
Instance Method Details
#load(execution:) ⇒ Hash
Returns log.
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/barbeque/execution_log.rb', line 43 def load(execution:) return {} if execution.pending? = get(execution, 'message.json') stdout = get(execution, 'stdout.txt') stderr = get(execution, 'stderr.txt') if || stdout || stderr { 'message' => , 'stdout' => stdout, 'stderr' => stderr, } else nil end end |
#save_message(execution, message) ⇒ Object
20 21 22 |
# File 'lib/barbeque/execution_log.rb', line 20 def (execution, ) put(execution, 'message.json', .body.to_json) end |
#save_stdout_and_stderr(execution, stdout, stderr) ⇒ Object
27 28 29 30 |
# File 'lib/barbeque/execution_log.rb', line 27 def save_stdout_and_stderr(execution, stdout, stderr) put(execution, 'stdout.txt', stdout) put(execution, 'stderr.txt', stderr) end |
#try_save_stdout_and_stderr(execution, stdout, stderr) ⇒ Object
35 36 37 38 39 |
# File 'lib/barbeque/execution_log.rb', line 35 def try_save_stdout_and_stderr(execution, stdout, stderr) save_stdout_and_stderr(execution, stdout, stderr) rescue Aws::S3::Errors::ServiceError => e ExceptionHandler.handle_exception(e) end |