easy_ml 0.2.0.pre.rc96 → 0.2.0.pre.rc98

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: 86ad2fdcb22b78a52793bcb4872563a52d7bac3b923d2fbccf990aa057e2955c
4
- data.tar.gz: dd8f47b3f99edb720ad3255dfb0e8774a689dd5b780730a9dd01a0605f314e26
3
+ metadata.gz: 8c105c4f00c13b7654204ff04d2ffcec27657a4fd3386a7712fba6da90bd733a
4
+ data.tar.gz: 141dc35ad18183a64b73b9cebc57ecebdfc5e9855c9afa52a0270e904bfcc651
5
5
  SHA512:
6
- metadata.gz: ca4fe8d77662e99558351d4b2fffe259097248ad5c3272c8e42d8e20643745e4e3ccfa717c4028918fc1b658ffb7cf79661d9fb359c772ec2c10c30e87959ed1
7
- data.tar.gz: c9cb19869c2f804b0223679c493e4ed1c30d317c0b1e06c051a267c123e37cc40a16d48ea574459d0f54c3280d208f35c85fa5c4e89014c402a211401075e4cb
6
+ metadata.gz: 2412eed49dd5824d871037ee4806a7fdf970caf034d03a504ae1020fa3d71aa79a9fb544ed5208c65ca1f4bd7be05f5a60ffd57c17187d3986f64b1c2a0f0f4d
7
+ data.tar.gz: 5e2416e89e5855b1fddfee0072a0b750880fb4f7afbf47968d3e0e8f8e20e5eb95ced11ff05cd9df79473cbc6621006148b1965c2439477757aa78c1340e2415
@@ -9,17 +9,17 @@ module EasyML
9
9
  def bump_version(force: false)
10
10
  return version if version.present? && !force
11
11
 
12
- tz = ActiveSupport::TimeZone.new(EasyML::Configuration.timezone)
12
+ tz = ActiveSupport::TimeZone.new(EasyML::Support::UTC)
13
13
  orig_version = version
14
14
  prev_version = tz.parse(version.gsub(/_/, "")) if version
15
- timestamp = Time.current.in_time_zone(EasyML::Configuration.timezone)
15
+ timestamp = Time.current.in_time_zone(EasyML::Support::UTC)
16
16
  timestamp = (prev_version + 1.second) if prev_version && compare_versions(timestamp, prev_version)
17
17
 
18
18
  self.version = timestamp.strftime(STRING_FORMAT)
19
19
  end
20
20
 
21
21
  def compare_versions(version1, version2)
22
- tz = ActiveSupport::TimeZone.new(EasyML::Configuration.timezone)
22
+ tz = ActiveSupport::TimeZone.new(EasyML::Support::UTC)
23
23
  tz.parse(version1.strftime(STRING_FORMAT).gsub(/_/, "")) <= tz.parse(version2.strftime(STRING_FORMAT).gsub(/_/, ""))
24
24
  end
25
25
  end
@@ -667,8 +667,6 @@ module EasyML
667
667
  end
668
668
 
669
669
  def upload_remote_files
670
- return if !needs_refresh?
671
-
672
670
  processed.upload.tap do
673
671
  features.each(&:upload_remote_files)
674
672
  features.each(&:save)
@@ -65,8 +65,14 @@ module EasyML
65
65
 
66
66
  EasyML::Deploy.transaction do
67
67
  update(model_history_id: self.model_version.id, snapshot_id: self.model_version.snapshot_id, status: :success)
68
- model.retraining_runs.where(status: :deployed).update_all(status: :success)
69
- retraining_run.update(model_history_id: self.model_version.id, snapshot_id: self.model_version.snapshot_id, deploy_id: id, status: :deployed,)
68
+ model.retraining_runs.where(status: :deployed).update_all(status: :success, is_deploying: false)
69
+ retraining_run.update(
70
+ model_history_id: self.model_version.id,
71
+ snapshot_id: self.model_version.snapshot_id,
72
+ deploy_id: id,
73
+ status: :deployed,
74
+ is_deploying: false
75
+ )
70
76
  end
71
77
 
72
78
  model_version.tap do
@@ -267,7 +267,7 @@ module EasyML
267
267
 
268
268
  def formatted_version
269
269
  return nil unless version
270
- 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")
271
271
  end
272
272
 
273
273
  def last_run_at
@@ -36,6 +36,10 @@ module EasyML
36
36
  )
37
37
  end
38
38
 
39
+ def s3_prefix
40
+ EasyML::Configuration.model_s3_path(model.name)
41
+ end
42
+
39
43
  def root_dir
40
44
  Pathname.new(model.root_dir)
41
45
  end
@@ -21,6 +21,16 @@ module EasyML
21
21
 
22
22
  validates :storage, inclusion: { in: %w[file s3] }, if: -> { storage.present? }
23
23
 
24
+ after_initialize :set_defaults, if: -> { new_record? }
25
+
26
+ def set_defaults
27
+ self.s3_prefix ||= "easy_ml"
28
+ end
29
+
30
+ def s3_prefix
31
+ read_attribute(:s3_prefix) || "easy_ml"
32
+ end
33
+
24
34
  TIMEZONES = [
25
35
  { value: "America/New_York", label: "Eastern Time" },
26
36
  { value: "America/Chicago", label: "Central Time" },
@@ -60,5 +60,17 @@ module EasyML
60
60
  def db_settings
61
61
  @db_settings ||= EasyML::Settings.first_or_create
62
62
  end
63
+
64
+ def self.s3_path_for(type, name)
65
+ File.join(instance.s3_prefix, type.to_s, name.to_s)
66
+ end
67
+
68
+ def self.model_s3_path(model_name)
69
+ s3_path_for("models", model_name.parameterize.gsub("-", "_"))
70
+ end
71
+
72
+ def self.dataset_s3_path(relative_path)
73
+ s3_path_for("datasets", relative_path)
74
+ end
63
75
  end
64
76
  end
@@ -125,6 +125,10 @@ module EasyML
125
125
  synced_directory.download
126
126
  end
127
127
 
128
+ def remote_files
129
+ synced_directory.remote_files
130
+ end
131
+
128
132
  private
129
133
 
130
134
  def root
@@ -46,7 +46,9 @@ module EasyML
46
46
  end
47
47
 
48
48
  def s3_prefix
49
- File.join("datasets", dir.split("datasets").last)
49
+ EasyML::Configuration.dataset_s3_path(
50
+ dir.split("datasets").last
51
+ )
50
52
  end
51
53
 
52
54
  def synced_directory
@@ -36,6 +36,19 @@ module EasyML
36
36
  )
37
37
  end
38
38
 
39
+ # Expose S3 information for testing and verification
40
+ def s3_prefix
41
+ EasyML::Configuration.dataset_s3_path(
42
+ File.join(feature_dir.split("datasets").last, "compacted")
43
+ )
44
+ end
45
+
46
+ def s3_key(filename = nil)
47
+ filename ||= File.basename(files.first) if files.any?
48
+ return nil unless filename
49
+ File.join(s3_prefix, filename)
50
+ end
51
+
39
52
  private
40
53
 
41
54
  def batch_size
@@ -49,9 +62,5 @@ module EasyML
49
62
  feature&.name&.parameterize&.gsub("-", "_")
50
63
  )
51
64
  end
52
-
53
- def s3_prefix
54
- File.join("datasets", feature_dir.split("datasets").last)
55
- end
56
65
  end
57
66
  end
@@ -52,6 +52,10 @@ module EasyML
52
52
  full_path
53
53
  end
54
54
 
55
+ def s3_key
56
+ s3_prefix.present? ? File.join(s3_prefix, filename) : filename
57
+ end
58
+
55
59
  def path
56
60
  File.join(root_dir, s3_prefix)
57
61
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EasyML
4
- VERSION = "0.2.0-rc96"
4
+ VERSION = "0.2.0-rc98"
5
5
 
6
6
  module Version
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: easy_ml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0.pre.rc96
4
+ version: 0.2.0.pre.rc98
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Shollenberger
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-03-06 00:00:00.000000000 Z
11
+ date: 2025-03-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord