etna 0.1.50 → 0.1.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be19e727959bd06d5af503f7a3bbc30fde48fe7aa0db200b93c32f656bd1a642
|
4
|
+
data.tar.gz: 179736a0638b7e200bb9a55aeae79fddf852a9d5e0fb33c7650a11e06bfc11f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7ac565d1132f522d6f955f250c0e23762909294ede0370f5d2e3ff3fad503f78c4e26de5cd95d035defff96ab8c533ca72fd339d998ce2306e48b1cf955cc9a
|
7
|
+
data.tar.gz: a765da090dafc236beace6473fb6c18b56060406ed3d6f0f50b92cc2c06cde29cb1e86b35a0f14015cdcdfaa28c6aa598cb4881a8f54be6ac607c7da61925137
|
data/lib/commands.rb
CHANGED
@@ -250,10 +250,10 @@ class EtnaApp
|
|
250
250
|
string_flags << "--log-file"
|
251
251
|
string_flags << "--log-level"
|
252
252
|
string_flags << "--concurrency"
|
253
|
-
string_flags << "--
|
253
|
+
string_flags << "--page-size"
|
254
|
+
boolean_flags << "--list-only"
|
254
255
|
|
255
|
-
|
256
|
-
def execute(project_name:, log_file:'/dev/stdout', log_level: ::Logger::INFO, concurrency: 1, page_size: 20)
|
256
|
+
def execute(project_name:, log_file:'/dev/stdout', log_level: ::Logger::INFO, concurrency: 1, page_size: 20, list_only: false)
|
257
257
|
logger = Etna::Logger.new(log_file, 0, 1048576)
|
258
258
|
|
259
259
|
logger.level = log_level
|
@@ -267,6 +267,7 @@ class EtnaApp
|
|
267
267
|
logger: logger,
|
268
268
|
project_name: project_name,
|
269
269
|
model_name: 'project', filesystem: filesystem,
|
270
|
+
list_only: list_only,
|
270
271
|
page_size: page_size.to_i,
|
271
272
|
concurrency: concurrency.to_i)
|
272
273
|
|
@@ -9,10 +9,10 @@ module Etna
|
|
9
9
|
:metis_client, :magma_client, :project_name,
|
10
10
|
:model_name, :model_filters, :model_attributes_mask,
|
11
11
|
:filesystem, :logger, :stub_files, :concurrency,
|
12
|
-
:page_size, :record_names, keyword_init: true)
|
12
|
+
:page_size, :record_names, :list_only, keyword_init: true)
|
13
13
|
|
14
14
|
def initialize(**kwds)
|
15
|
-
super(**({filesystem: Etna::Filesystem.new, page_size: 20, concurrency: 10, record_names: "all"}.update(kwds)))
|
15
|
+
super(**({filesystem: Etna::Filesystem.new, page_size: 20, concurrency: 10, record_names: "all", list_only: false}.update(kwds)))
|
16
16
|
end
|
17
17
|
|
18
18
|
def magma_crud
|
@@ -108,17 +108,27 @@ module Etna
|
|
108
108
|
end
|
109
109
|
|
110
110
|
dest_file = File.join(dest_dir, metadata_file_name(record_name: record[template.identifier], record_model_name: template.name, ext: "_#{attr_name}_#{idx}#{File.extname(filename)}"))
|
111
|
-
|
112
|
-
|
113
|
-
|
111
|
+
|
112
|
+
if list_only
|
113
|
+
puts dest_file
|
114
|
+
else
|
115
|
+
filesystem.mkdir_p(File.dirname(dest_file))
|
116
|
+
sync_metis_data_workflow.copy_file(dest: dest_file, url: url, stub: stub_files)
|
117
|
+
record_to_serialize[attr_name] << {file: dest_file, original_filename: filename}
|
118
|
+
end
|
114
119
|
end
|
115
120
|
|
116
121
|
dest_file = File.join(dest_dir, metadata_file_name(record_name: record[template.identifier], record_model_name: template.name, ext: '.json'))
|
117
|
-
filesystem.mkdir_p(File.dirname(dest_file))
|
118
|
-
json = record_to_serialize.to_json
|
119
122
|
|
120
|
-
|
121
|
-
|
123
|
+
if list_only
|
124
|
+
puts dest_file
|
125
|
+
else
|
126
|
+
filesystem.mkdir_p(File.dirname(dest_file))
|
127
|
+
json = record_to_serialize.to_json
|
128
|
+
|
129
|
+
filesystem.with_writeable(dest_file, "w", size_hint: json.bytes.length) do |io|
|
130
|
+
io.write(json)
|
131
|
+
end
|
122
132
|
end
|
123
133
|
end
|
124
134
|
|
@@ -63,12 +63,21 @@ module Etna
|
|
63
63
|
page_size: 100,
|
64
64
|
&block)
|
65
65
|
q = [ { model_name: model_name, from: nil, record_names: record_names } ]
|
66
|
-
seen =
|
66
|
+
seen = {}
|
67
67
|
|
68
68
|
while (path = q.pop)
|
69
69
|
model_name = path[:model_name]
|
70
|
-
|
71
|
-
|
70
|
+
seen[model_name] ||= Set.new
|
71
|
+
|
72
|
+
new_record_names = path[:record_names]
|
73
|
+
|
74
|
+
if new_record_names.is_a?(Array)
|
75
|
+
new_record_names -= seen[model_name].to_a
|
76
|
+
|
77
|
+
next if new_record_names.empty?
|
78
|
+
|
79
|
+
seen[model_name].merge(new_record_names)
|
80
|
+
end
|
72
81
|
|
73
82
|
template = template_for(model_name)
|
74
83
|
query_attributes, walk_attributes = masked_attributes(
|
@@ -80,7 +89,7 @@ module Etna
|
|
80
89
|
request = RetrievalRequest.new(
|
81
90
|
project_name: magma_crud.project_name,
|
82
91
|
model_name: model_name,
|
83
|
-
record_names:
|
92
|
+
record_names: new_record_names,
|
84
93
|
filter: model_filters[model_name],
|
85
94
|
attribute_names: query_attributes,
|
86
95
|
page_size: page_size, page: 1
|
@@ -96,6 +105,8 @@ module Etna
|
|
96
105
|
attributes = []
|
97
106
|
model = response.models.model(model_name)
|
98
107
|
|
108
|
+
seen[model_name].merge( model.documents.document_keys )
|
109
|
+
|
99
110
|
template.attributes.attribute_keys.each do |attr_name|
|
100
111
|
attr = template.attributes.attribute(attr_name)
|
101
112
|
if attr.attribute_type == AttributeType::TABLE && attribute_included?(walk_attributes, attr_name)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: etna
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.51
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Saurabh Asthana
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-03-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|