easy_ml 0.2.0.pre.rc95 → 0.2.0.pre.rc97
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: a7de56b964119aa83ec62b64cf28fddc4f83ae3947d99a656643fe7355662ac5
|
4
|
+
data.tar.gz: fbdf0cdf54e96c128c37a5998cd2cf20135229e25320e1cce5b003defa448a52
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 202db609a33bdd29437450364bb945e4a51cfe18f6e6b075f343ec504489a88f254b90c5e14e87d0098c917d372a6adc1ad51800627acc08de57fbc4269fb375
|
7
|
+
data.tar.gz: fcb1ab6d584f6b55d68ffc5a4118807443d61e26dd85cd3968bcd57cec4aa1d1183c2703956f06f38bf549ec7ef705aecb094014149685a761d7b1e4766720ee
|
@@ -4,14 +4,23 @@ module EasyML
|
|
4
4
|
extend ActiveSupport::Concern
|
5
5
|
|
6
6
|
included do
|
7
|
+
STRING_FORMAT = "%Y_%m_%d_%H_%M_%S".freeze
|
8
|
+
|
7
9
|
def bump_version(force: false)
|
8
10
|
return version if version.present? && !force
|
9
11
|
|
10
|
-
|
11
|
-
|
12
|
-
|
12
|
+
tz = ActiveSupport::TimeZone.new(EasyML::Support::UTC)
|
13
|
+
orig_version = version
|
14
|
+
prev_version = tz.parse(version.gsub(/_/, "")) if version
|
15
|
+
timestamp = Time.current.in_time_zone(EasyML::Support::UTC)
|
16
|
+
timestamp = (prev_version + 1.second) if prev_version && compare_versions(timestamp, prev_version)
|
17
|
+
|
18
|
+
self.version = timestamp.strftime(STRING_FORMAT)
|
19
|
+
end
|
13
20
|
|
14
|
-
|
21
|
+
def compare_versions(version1, version2)
|
22
|
+
tz = ActiveSupport::TimeZone.new(EasyML::Support::UTC)
|
23
|
+
tz.parse(version1.strftime(STRING_FORMAT).gsub(/_/, "")) <= tz.parse(version2.strftime(STRING_FORMAT).gsub(/_/, ""))
|
15
24
|
end
|
16
25
|
end
|
17
26
|
end
|
@@ -114,6 +114,10 @@ module EasyML
|
|
114
114
|
write_attribute(:root_dir, value)
|
115
115
|
end
|
116
116
|
|
117
|
+
def dir
|
118
|
+
root_dir
|
119
|
+
end
|
120
|
+
|
117
121
|
def set_root_dir
|
118
122
|
bump_version
|
119
123
|
write_attribute(:root_dir, default_root_dir)
|
@@ -211,12 +215,13 @@ module EasyML
|
|
211
215
|
end
|
212
216
|
|
213
217
|
def bump_versions(version)
|
218
|
+
original_version = self.version
|
214
219
|
self.version = version
|
215
220
|
|
216
|
-
@raw = raw.cp(version)
|
217
|
-
@processed = processed.cp(version)
|
221
|
+
@raw = raw.cp(dir.gsub(original_version, version))
|
222
|
+
@processed = processed.cp(dir.gsub(original_version, version))
|
218
223
|
save.tap do
|
219
|
-
features.each(
|
224
|
+
features.each { |feature| feature.bump_version(original_version, version) }
|
220
225
|
EasyML::Feature.import(features.to_a, on_duplicate_key_update: [:version])
|
221
226
|
end
|
222
227
|
end
|
@@ -750,7 +755,7 @@ module EasyML
|
|
750
755
|
split_type.new(**args)
|
751
756
|
when EasyML::Data::Splits::FileSplit.to_s
|
752
757
|
split_type.new(**args.merge(
|
753
|
-
dir: Pathname.new(root_dir).
|
758
|
+
dir: Pathname.new(root_dir).join("files/splits/#{type}").to_s,
|
754
759
|
))
|
755
760
|
end
|
756
761
|
end
|
@@ -433,9 +433,9 @@ module EasyML
|
|
433
433
|
end
|
434
434
|
end
|
435
435
|
|
436
|
-
def bump_version
|
437
|
-
feature_store.bump_version(version)
|
438
|
-
write_attribute(:version, version + 1)
|
436
|
+
def bump_version(original_version, version)
|
437
|
+
feature_store.bump_version(original_version, version)
|
438
|
+
write_attribute(:version, self.version + 1)
|
439
439
|
self
|
440
440
|
end
|
441
441
|
|
data/app/models/easy_ml/model.rb
CHANGED
@@ -203,6 +203,7 @@ module EasyML
|
|
203
203
|
|
204
204
|
def unlock!
|
205
205
|
Support::Lockable.unlock!(lock_key)
|
206
|
+
EasyML::Deploy.new(model: self).unlock!
|
206
207
|
end
|
207
208
|
|
208
209
|
def lock_model
|
@@ -266,7 +267,7 @@ module EasyML
|
|
266
267
|
|
267
268
|
def formatted_version
|
268
269
|
return nil unless version
|
269
|
-
UTC.parse(version).in_time_zone(EasyML::Configuration.timezone).strftime("%B %-d, %Y at %-l:%M %p")
|
270
|
+
EasyML::Support::UTC.parse(version.gsub(/_/, "")).in_time_zone(EasyML::Configuration.timezone).strftime("%B %-d, %Y at %-l:%M %p")
|
270
271
|
end
|
271
272
|
|
272
273
|
def last_run_at
|
@@ -558,6 +559,7 @@ module EasyML
|
|
558
559
|
dataset.upload_remote_files
|
559
560
|
model_snapshot = snapshot
|
560
561
|
|
562
|
+
Thread.current[:deploying] = true
|
561
563
|
# Prepare the model to be retrained (reset values so they don't conflict with our snapshotted version)
|
562
564
|
bump_version(force: true)
|
563
565
|
dataset.bump_versions(version)
|
@@ -1,9 +1,10 @@
|
|
1
1
|
module EasyML
|
2
2
|
class FeatureStore < EasyML::Data::DatasetManager
|
3
|
-
attr_reader :feature
|
3
|
+
attr_reader :feature, :dataset
|
4
4
|
|
5
5
|
def initialize(feature)
|
6
6
|
@feature = feature
|
7
|
+
@dataset = feature&.dataset
|
7
8
|
|
8
9
|
datasource_config = feature&.dataset&.datasource&.configuration
|
9
10
|
if datasource_config
|
@@ -27,11 +28,11 @@ module EasyML
|
|
27
28
|
files.any?
|
28
29
|
end
|
29
30
|
|
30
|
-
def bump_version(version)
|
31
|
+
def bump_version(original_version, version)
|
31
32
|
compact
|
32
33
|
cp(
|
33
|
-
|
34
|
-
|
34
|
+
feature_dir.gsub(version, original_version),
|
35
|
+
feature_dir,
|
35
36
|
)
|
36
37
|
end
|
37
38
|
|
@@ -41,21 +42,14 @@ module EasyML
|
|
41
42
|
@batch_size ||= feature.batch_size || 10_000
|
42
43
|
end
|
43
44
|
|
44
|
-
def
|
45
|
+
def feature_dir
|
45
46
|
File.join(
|
46
|
-
|
47
|
-
"easy_ml/datasets",
|
48
|
-
feature&.dataset&.name&.parameterize&.gsub("-", "_"),
|
47
|
+
dataset.dir,
|
49
48
|
"features",
|
50
|
-
feature&.name&.parameterize&.gsub("-", "_")
|
51
|
-
version.to_s
|
49
|
+
feature&.name&.parameterize&.gsub("-", "_")
|
52
50
|
)
|
53
51
|
end
|
54
52
|
|
55
|
-
def feature_dir
|
56
|
-
feature_dir_for_version(feature.version)
|
57
|
-
end
|
58
|
-
|
59
53
|
def s3_prefix
|
60
54
|
File.join("datasets", feature_dir.split("datasets").last)
|
61
55
|
end
|
data/lib/easy_ml/version.rb
CHANGED