etna 0.1.48 → 0.1.50

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: aea22f69c338ad0b9b7a580ed1e5f91b4d8166c2ab129ed371f5a17b273aab80
4
- data.tar.gz: fcd7e348f3620f267763a3206e8f47663a1d10ce839e00dfdecab214f78fc79a
3
+ metadata.gz: 2d4a9a5034898ac9abf629e6ecbf0bdc3856c2ed9a0d43afe03147b2d6ff777d
4
+ data.tar.gz: c4d65c138d401605aba76e1e0eff1a4e860778d982cb6a7c04d834e829fa3df2
5
5
  SHA512:
6
- metadata.gz: 38ad3b89bef7df3f92370b4adaf5eed503321149ca9f33c8b20d08c0d27d7bf7deaf9511d6582943e4ed1d53aaea7fdf06520473acdab1c94ddf4996526e8f61
7
- data.tar.gz: 5d60ee51a5fea1580739ac1d83827dc241ca58aa0e5446a4715872a89a5c7bdef0c4d9ef9f525713e13b932ae68a269d4acfa629fc817ee23683d0960a9f7e47
6
+ metadata.gz: 20505cf23f06bea3343194a4f956b7ffec44786cef9a92b5a78f48aa7793dec746aa710b8007c96f9d4d9ba5001c2e9e3464d464458873fcb4d43bed43dbee09
7
+ data.tar.gz: 8bc2f47aaa9daa3a211ce40ce5b3649e82d435225370533e8d34628b3c8d302a60051a68cc99a35b760a6d021df087fdd37d200c8062a933f5f10d599af9ad53
data/lib/commands.rb CHANGED
@@ -250,9 +250,10 @@ class EtnaApp
250
250
  string_flags << "--log-file"
251
251
  string_flags << "--log-level"
252
252
  string_flags << "--concurrency"
253
+ string_flags << "--page_size"
253
254
 
254
255
 
255
- def execute(project_name:, log_file:'/dev/stdout', log_level: ::Logger::INFO, concurrency: 1)
256
+ def execute(project_name:, log_file:'/dev/stdout', log_level: ::Logger::INFO, concurrency: 1, page_size: 20)
256
257
  logger = Etna::Logger.new(log_file, 0, 1048576)
257
258
 
258
259
  logger.level = log_level
@@ -266,6 +267,7 @@ class EtnaApp
266
267
  logger: logger,
267
268
  project_name: project_name,
268
269
  model_name: 'project', filesystem: filesystem,
270
+ page_size: page_size.to_i,
269
271
  concurrency: concurrency.to_i)
270
272
 
271
273
  workflow.materialize_all(project_name)
data/lib/etna/client.rb CHANGED
@@ -293,9 +293,9 @@ module Etna
293
293
  status_check!(response)
294
294
  return response
295
295
  end unless block_given?
296
+ else
297
+ raise ::Etna::Error, "Could not contact server, giving up"
296
298
  end
297
-
298
- raise ::Etna::Error, "Could not contact server, giving up" unless block_given?
299
299
  end
300
300
 
301
301
  private
@@ -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
- :record_names, keyword_init: true)
12
+ :page_size, :record_names, keyword_init: true)
13
13
 
14
14
  def initialize(**kwds)
15
- super(**({filesystem: Etna::Filesystem.new, concurrency: 10, record_names: "all"}.update(kwds)))
15
+ super(**({filesystem: Etna::Filesystem.new, page_size: 20, concurrency: 10, record_names: "all"}.update(kwds)))
16
16
  end
17
17
 
18
18
  def magma_crud
@@ -34,7 +34,7 @@ module Etna
34
34
  record_names,
35
35
  model_attributes_mask: model_attributes_mask,
36
36
  model_filters: model_filters,
37
- page_size: 20,
37
+ page_size: page_size,
38
38
  ) do |template, document|
39
39
  logger&.info("Materializing #{template.name}##{document[template.identifier]}")
40
40
  templates[template.name] = template
@@ -81,7 +81,7 @@ module Etna
81
81
 
82
82
  upload_timings << [chunk.length, Time.now.to_f]
83
83
  upload_amount += chunk.length
84
- remaining -= chunk.length
84
+ remaining -= chunk.length unless remaining.nil?
85
85
 
86
86
  if upload_timings.length > 150
87
87
  s, _ = upload_timings.shift
@@ -3,6 +3,8 @@ module Etna
3
3
  SIZE_UNITS = %W(B KiB MiB GiB TiB).freeze
4
4
 
5
5
  def self.as_size(number)
6
+ return "unknown" if number.nil?
7
+
6
8
  if number.to_i < 1024
7
9
  exponent = 0
8
10
  else
data/lib/etna/route.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'digest'
2
2
  require 'date'
3
+ require 'net/http'
3
4
  require "addressable/uri"
4
5
  require_relative "./censor"
5
6
  require_relative './instrumentation'
@@ -46,7 +47,7 @@ module Etna
46
47
  if params
47
48
  PARAM_TYPES.reduce(route) do |path,pat|
48
49
  path.gsub(pat) do
49
- params[$1.to_sym].split('/').map { |c| block_given? ? yield(c) : Addressable::URI.normalized_encode(c) }.join('/')
50
+ params[$1.to_sym].split('/').map { |c| block_given? ? yield(c) : Etna::Route.encode_path_component(c) }.join('/')
50
51
  end
51
52
  end
52
53
  else
@@ -54,6 +55,12 @@ module Etna
54
55
  end
55
56
  end
56
57
 
58
+ def self.encode_path_component(path_component)
59
+ form_encoded = URI.encode_www_form_component(path_component)
60
+ # Because of issues #1005, #1006, #1197
61
+ form_encoded.gsub('+', '%20')
62
+ end
63
+
57
64
  def path(params=nil, &block)
58
65
  self.class.path(@route, params, &block)
59
66
  end
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.48
4
+ version: 0.1.50
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-02-03 00:00:00.000000000 Z
11
+ date: 2023-02-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack