easy_ml 0.2.0.pre.rc97 → 0.2.0.pre.rc99

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: a7de56b964119aa83ec62b64cf28fddc4f83ae3947d99a656643fe7355662ac5
4
- data.tar.gz: fbdf0cdf54e96c128c37a5998cd2cf20135229e25320e1cce5b003defa448a52
3
+ metadata.gz: c65153b704330d5ef94c4844bbe505c91ff3bf3d6a67b21375f5178679a4bf68
4
+ data.tar.gz: 7ffbe174d6be8d6fdd43767ab383a186c211a279aa2e07eb258372ab67b88d27
5
5
  SHA512:
6
- metadata.gz: 202db609a33bdd29437450364bb945e4a51cfe18f6e6b075f343ec504489a88f254b90c5e14e87d0098c917d372a6adc1ad51800627acc08de57fbc4269fb375
7
- data.tar.gz: fcb1ab6d584f6b55d68ffc5a4118807443d61e26dd85cd3968bcd57cec4aa1d1183c2703956f06f38bf549ec7ef705aecb094014149685a761d7b1e4766720ee
6
+ metadata.gz: 318d8ddafdf1de61cfad9c9afa64b4c29ac27bf3745d37249bccee94dc80886293fe63744a8e3a3d049c75c8134748d061b5c7087dcc534f18990b63ed2030bf
7
+ data.tar.gz: 3f329b087f27044b9da1711716208b551161affe1c6f9c96edf2d5f729c30d3de9bd40c2931eef09a126f8826924615f3331fca71478f13d2659e83cdc484ff1
@@ -29,8 +29,6 @@ module EasyML
29
29
  end
30
30
  end
31
31
 
32
- private
33
-
34
32
  def files_to_keep_for_dir(dir)
35
33
  files_to_keep.map(&:to_s).select { |f| f.start_with?(dir.to_s) }
36
34
  end
@@ -55,8 +53,12 @@ module EasyML
55
53
  end
56
54
  end
57
55
 
56
+ def test_mode?
57
+ Rails.env.test?
58
+ end
59
+
58
60
  def model_files_to_keep
59
- if Rails.env.test?
61
+ if test_mode?
60
62
  []
61
63
  else
62
64
  active_models.map(&:model_file).compact.map(&:full_path).uniq
@@ -64,15 +66,15 @@ module EasyML
64
66
  end
65
67
 
66
68
  def dataset_files_to_keep
67
- if Rails.env.test?
69
+ if test_mode?
68
70
  []
69
71
  else
70
- EasyML::Dataset.all.flat_map(&:files).uniq
72
+ EasyML::Dataset.all.flat_map(&:files).uniq + active_models.map(&:dataset).flat_map(&:files).uniq
71
73
  end
72
74
  end
73
75
 
74
76
  def datasource_files_to_keep
75
- if Rails.env.test?
77
+ if test_mode?
76
78
  Dir.glob(EasyML::Engine.root_dir.glob("datasources/**/*.{csv,parquet}")).uniq
77
79
  else
78
80
  EasyML::Datasource.all.flat_map(&:files).uniq
@@ -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
@@ -559,7 +559,6 @@ module EasyML
559
559
  dataset.upload_remote_files
560
560
  model_snapshot = snapshot
561
561
 
562
- Thread.current[:deploying] = true
563
562
  # Prepare the model to be retrained (reset values so they don't conflict with our snapshotted version)
564
563
  bump_version(force: true)
565
564
  dataset.bump_versions(version)
@@ -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-rc97"
4
+ VERSION = "0.2.0-rc99"
5
5
 
6
6
  module Version
7
7
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: easy_ml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0.pre.rc97
4
+ version: 0.2.0.pre.rc99
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Shollenberger
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2025-03-06 00:00:00.000000000 Z
10
+ date: 2025-03-07 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: activerecord
@@ -865,7 +864,6 @@ metadata:
865
864
  homepage_uri: https://github.com/brettshollenberger/easy_ml
866
865
  source_code_uri: https://github.com/brettshollenberger/easy_ml
867
866
  changelog_uri: https://github.com/brettshollenberger/easy_ml
868
- post_install_message:
869
867
  rdoc_options: []
870
868
  require_paths:
871
869
  - lib
@@ -876,12 +874,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
876
874
  version: 3.0.0
877
875
  required_rubygems_version: !ruby/object:Gem::Requirement
878
876
  requirements:
879
- - - ">"
877
+ - - ">="
880
878
  - !ruby/object:Gem::Version
881
- version: 1.3.1
879
+ version: '0'
882
880
  requirements: []
883
- rubygems_version: 3.4.10
884
- signing_key:
881
+ rubygems_version: 3.6.5
885
882
  specification_version: 4
886
883
  summary: Effortless Machine Learning in Ruby
887
884
  test_files: []