Class: EtnaApp::Magma::Materialize
- Inherits:
-
Etna::Command
- Object
- Etna::Command
- EtnaApp::Magma::Materialize
- Includes:
- WithEtnaClients
- Defined in:
- lib/commands.rb
Instance Attribute Summary
Attributes inherited from Etna::Command
Instance Method Summary collapse
- #execute(project_name:, log_file: '/dev/stdout', log_level: ::Logger::INFO, concurrency: 1, page_size: 20, list_only: false) ⇒ Object
- #filesystem ⇒ Object
- #model_attribute_pairs(project_name) ⇒ Object
Methods included from WithEtnaClients
#environment, #exit, exit, #janus_client, #magma_client, #metis_client, #polyphemus_client, #token
Methods inherited from Etna::Command
#completions, #fill_in_missing_params, #find_command, #initialize, parent_scope, #setup
Methods included from Etna::CommandOrExecutor
#command_name, #completions_for, #desc, #flag_argspec, #flag_as_parameter, included, #parse_flags, #program_name, #usage
Constructor Details
This class inherits a constructor from Etna::Command
Instance Method Details
#execute(project_name:, log_file: '/dev/stdout', log_level: ::Logger::INFO, concurrency: 1, page_size: 20, list_only: false) ⇒ Object
256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 |
# File 'lib/commands.rb', line 256 def execute(project_name:, log_file:'/dev/stdout', log_level: ::Logger::INFO, concurrency: 1, page_size: 20, list_only: false) logger = Etna::Logger.new(log_file, 0, 1048576) logger.level = log_level workflow = Etna::Clients::Magma::MaterializeDataWorkflow.new( model_attributes_mask: model_attribute_pairs(project_name), record_names: 'all', model_filters: {}, metis_client: metis_client(logger: logger), magma_client: magma_client(logger: logger), logger: logger, project_name: project_name, model_name: 'project', filesystem: filesystem, list_only: list_only, page_size: page_size.to_i, concurrency: concurrency.to_i) workflow.materialize_all(project_name) logger.info("Done") end |
#filesystem ⇒ Object
293 294 295 |
# File 'lib/commands.rb', line 293 def filesystem @filesystem ||= Etna::Filesystem.new end |
#model_attribute_pairs(project_name) ⇒ Object
278 279 280 281 282 283 284 285 286 287 288 289 290 291 |
# File 'lib/commands.rb', line 278 def model_attribute_pairs(project_name) models = magma_client.retrieve(Etna::Clients::Magma::RetrievalRequest.new( project_name: project_name, model_name: 'all', attribute_names: 'all', record_names: [] )).models result = models.model_keys.map do |model_name| [ model_name, models.model(model_name).template.attributes.attribute_keys ] end.to_h result end |