easy_ml 0.2.0.pre.rc94 → 0.2.0.pre.rc96

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: 054ef06f827068239a9fd2c28ecaafe2a606c6eeb52271319777580a23cc131a
4
- data.tar.gz: 3b93ecb131ca07fdc06a2495cf72159bb7c72871c75e294f8c544165d1b1d2dc
3
+ metadata.gz: 86ad2fdcb22b78a52793bcb4872563a52d7bac3b923d2fbccf990aa057e2955c
4
+ data.tar.gz: dd8f47b3f99edb720ad3255dfb0e8774a689dd5b780730a9dd01a0605f314e26
5
5
  SHA512:
6
- metadata.gz: 8257f161fa333b4b7c76e1d3aa3c5c87399378d0316c7b25ac0576d9c37e77367bc4fdd5942696f3dbbd7a4607eaecd98c202be651916b966e4186a69f3e7cc4
7
- data.tar.gz: 12f4a33cb003cc8a0cd504f3d328819ed3007d95aa0f3c8719a17ba3ae291b96ce1c2dc9384d043e7c8e8abf84dd2c6da98e824b058fb04213832b67c331e1b4
6
+ metadata.gz: ca4fe8d77662e99558351d4b2fffe259097248ad5c3272c8e42d8e20643745e4e3ccfa717c4028918fc1b658ffb7cf79661d9fb359c772ec2c10c30e87959ed1
7
+ data.tar.gz: c9cb19869c2f804b0223679c493e4ed1c30d317c0b1e06c051a267c123e37cc40a16d48ea574459d0f54c3280d208f35c85fa5c4e89014c402a211401075e4cb
@@ -1,7 +1,7 @@
1
1
  import React, { useState } from 'react';
2
2
  import { usePage } from '@inertiajs/react'
3
3
  import { useInertiaForm } from 'use-inertia-form';
4
- import { Settings2, Save, AlertCircle, Key, Globe2, Database } from 'lucide-react';
4
+ import { Settings2, Save, AlertCircle, Key, Globe2, Database, GitBranch } from 'lucide-react';
5
5
  import { PluginSettings } from '../components/settings/PluginSettings';
6
6
 
7
7
  interface Settings {
@@ -9,6 +9,8 @@ interface Settings {
9
9
  timezone: string;
10
10
  s3_bucket: string;
11
11
  s3_region: string;
12
+ git_sha: string;
13
+ version: string;
12
14
  }
13
15
  }
14
16
 
@@ -156,6 +158,31 @@ export default function SettingsPage({ settings: initialSettings }: { settings:
156
158
  </div>
157
159
  </div>
158
160
 
161
+ {/* Deployment Information */}
162
+ <div className="space-y-4">
163
+ <div className="flex items-center gap-2 mb-4">
164
+ <GitBranch className="w-5 h-5 text-gray-500" />
165
+ <h3 className="text-lg font-medium text-gray-900">Deployment Information</h3>
166
+ </div>
167
+
168
+ <div className="bg-gray-50 rounded-lg p-4">
169
+ <div className="space-y-1">
170
+ <div className="flex items-center gap-2">
171
+ <span className="text-sm font-medium text-gray-700">Git SHA</span>
172
+ <span className="text-sm font-mono bg-gray-100 px-2 py-1 rounded text-gray-600">
173
+ {initialSettings?.settings?.git_sha || 'Not available'}
174
+ </span>
175
+ </div>
176
+ <div className="flex items-center gap-2">
177
+ <span className="text-sm font-medium text-gray-700">EasyML Version</span>
178
+ <span className="text-sm font-mono bg-gray-100 px-2 py-1 rounded text-gray-600">
179
+ {initialSettings?.settings?.version || 'Not available'}
180
+ </span>
181
+ </div>
182
+ </div>
183
+ </div>
184
+ </div>
185
+
159
186
  <div className="pt-6 border-t flex items-center justify-between">
160
187
  {saved && (
161
188
  <div className="flex items-center gap-2 text-green-600">
@@ -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
- prev_version = version
11
- timestamp = Time.now.utc.strftime("%Y%m%d%H%M%S")
12
- timestamp = (prev_version.to_i + 1).to_s if timestamp.to_i <= prev_version.to_i
12
+ tz = ActiveSupport::TimeZone.new(EasyML::Configuration.timezone)
13
+ orig_version = version
14
+ prev_version = tz.parse(version.gsub(/_/, "")) if version
15
+ timestamp = Time.current.in_time_zone(EasyML::Configuration.timezone)
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
- self.version = timestamp
21
+ def compare_versions(version1, version2)
22
+ tz = ActiveSupport::TimeZone.new(EasyML::Configuration.timezone)
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(&:bump_version)
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).append("files/splits/#{type}").to_s,
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
 
@@ -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
@@ -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)
@@ -5,5 +5,23 @@ module EasyML
5
5
  include JSONAPI::Serializer
6
6
 
7
7
  attributes *EasyML::Settings.configuration_attributes
8
+
9
+ attribute :version do |object|
10
+ EasyML::VERSION
11
+ end
12
+
13
+ attribute :git_sha do |object|
14
+ # Get git SHA of the main app
15
+ if Rails.root.join('.git').exist?
16
+ sha = `cd #{Rails.root} && git rev-parse HEAD`.strip
17
+ sha.presence || "Git SHA unavailable"
18
+ elsif ENV["GIT_REVISION"]
19
+ ENV["GIT_REVISION"]
20
+ else
21
+ "Not a git repository"
22
+ end
23
+ rescue
24
+ "Error determining git SHA"
25
+ end
8
26
  end
9
27
  end
@@ -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
- feature_dir_for_version(version),
34
- feature_dir_for_version(version + 1),
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 feature_dir_for_version(version)
45
+ def feature_dir
45
46
  File.join(
46
- Rails.root,
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
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EasyML
4
- VERSION = "0.2.0-rc94"
4
+ VERSION = "0.2.0-rc96"
5
5
 
6
6
  module Version
7
7
  end
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "entrypoints/Application.tsx": {
3
- "file": "assets/entrypoints/Application.tsx-KENNRQpC.js",
3
+ "file": "assets/entrypoints/Application.tsx-BXwsBCuQ.js",
4
4
  "name": "entrypoints/Application.tsx",
5
5
  "src": "entrypoints/Application.tsx",
6
6
  "isEntry": true,