easy_ml 0.2.0.pre.rc27 → 0.2.0.pre.rc28

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: e4a6be2396661a707287673f29f34b1426c0005053fca274186785aafb42cf24
4
- data.tar.gz: 8ef025d108be48a12b865c988c1ee68988e3845a618e7f46c5bd0bcd9c13f603
3
+ metadata.gz: 759592a8ae36ec3898d0acf83ff58ef0b0da9fd3cc3cfc492ac151cf8cc22360
4
+ data.tar.gz: d24de00abea52b9fe4d2d911075924134f66315d2e6a8fb9d0b28cbbbd7236ee
5
5
  SHA512:
6
- metadata.gz: a3b2b3fc9e5b3adbe0e294e4bbab9f453d2c064a9aac55c134df79a43966ea2bb6acb16422956687c36f3949456b6925f25d998816e22ec86bddf1bedf79e66a
7
- data.tar.gz: 75233c8e49b8c1998a091991144fc90bf7203f26c054590d8851e403352339925634084bef3c860d0be244a11f48ccca047afca1f33f85fcf33028fdc5b84f88
6
+ metadata.gz: f9743d17f8f429e86d7b5635f8dc72179fcd928f0a1cf394bc2b8ff750e7349a8383f4bd58e2d1e5b4ef96da670578034493c28fdd863b88a0022cddc87013eb
7
+ data.tar.gz: 22e5a0ebe5aaa8a53e8927b8caae83c5badfe1deea04885db5f2081ad0e30bfe3166279d0208b8b7363cfecf95a572afb3132a94217beda99bab9a1781090a68
@@ -0,0 +1,18 @@
1
+ module EasyML
2
+ class PredictionsController < ApplicationController
3
+ skip_before_action :verify_authenticity_token, only: [:create]
4
+
5
+ def create
6
+ model_name = params[:model]
7
+ input = params[:input]
8
+
9
+ predictions = EasyML::Predict.predict(model_name, input)
10
+
11
+ render json: { prediction: predictions.first }
12
+ rescue ActiveRecord::RecordNotFound
13
+ render json: { error: "Model not found" }, status: :not_found
14
+ rescue StandardError => e
15
+ render json: { error: e.message }, status: :unprocessable_entity
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,9 @@
1
+ module EasyML
2
+ class CleanJob < ApplicationJob
3
+ @queue = :easy_ml
4
+
5
+ def self.perform
6
+ EasyML::Cleaner.clean
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,17 @@
1
+ require "zhong"
2
+
3
+ Zhong.setup do |config|
4
+ config.logger = Rails.logger
5
+ config.time_zone = "UTC"
6
+
7
+ # Use Redis to persist the scheduler state
8
+ config.redis = Redis.new(
9
+ url: ENV.fetch("REDIS_URL") { "redis://localhost:6379/0" },
10
+ )
11
+ end
12
+
13
+ Zhong.schedule do
14
+ every 1.hour, "cleanup" do
15
+ CleanJob.perform_later
16
+ end
17
+ end
data/config/routes.rb CHANGED
@@ -1,6 +1,13 @@
1
1
  EasyML::Engine.routes.draw do
2
2
  root to: "models#index"
3
3
  get "healthcheck", to: "health#up"
4
+
5
+ mount Zhong::Web, at: "/zhong"
6
+ mount Resque::Server.new, at: "/resque"
7
+
8
+ # Predictions API
9
+ resources :predictions, only: [:create]
10
+
4
11
  resources :models, as: :easy_ml_models do
5
12
  member do
6
13
  post :train
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EasyML
4
- VERSION = "0.2.0-rc27"
4
+ VERSION = "0.2.0-rc28"
5
5
 
6
6
  module Version
7
7
  end
@@ -0,0 +1,6 @@
1
+ namespace :zhong do
2
+ desc "Run Zhong"
3
+ task start: :environment do
4
+ Zhong.start
5
+ end
6
+ 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.rc27
4
+ version: 0.2.0.pre.rc28
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-01-17 00:00:00.000000000 Z
11
+ date: 2025-01-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -447,6 +447,7 @@ files:
447
447
  - app/controllers/easy_ml/deploys_controller.rb
448
448
  - app/controllers/easy_ml/health_controller.rb
449
449
  - app/controllers/easy_ml/models_controller.rb
450
+ - app/controllers/easy_ml/predictions_controller.rb
450
451
  - app/controllers/easy_ml/retraining_runs_controller.rb
451
452
  - app/controllers/easy_ml/settings_controller.rb
452
453
  - app/easy_ml/.vite/manifest-assets.json
@@ -520,6 +521,7 @@ files:
520
521
  - app/helpers/easy_ml/application_helper.rb
521
522
  - app/jobs/easy_ml/application_job.rb
522
523
  - app/jobs/easy_ml/batch_job.rb
524
+ - app/jobs/easy_ml/clean_job.rb
523
525
  - app/jobs/easy_ml/compute_feature_job.rb
524
526
  - app/jobs/easy_ml/deploy_job.rb
525
527
  - app/jobs/easy_ml/finalize_feature_job.rb
@@ -590,6 +592,7 @@ files:
590
592
  - bin/vite
591
593
  - config/initializers/inflections.rb
592
594
  - config/initializers/resque.rb
595
+ - config/initializers/zhong.rb
593
596
  - config/resque-pool.yml
594
597
  - config/routes.rb
595
598
  - config/spring.rb
@@ -662,6 +665,7 @@ files:
662
665
  - lib/easy_ml/version.rb
663
666
  - lib/tasks/resque.rake
664
667
  - lib/tasks/vite.rake
668
+ - lib/tasks/zhong.rake
665
669
  - public/easy_ml/assets/.vite/manifest-assets.json
666
670
  - public/easy_ml/assets/.vite/manifest.json
667
671
  - public/easy_ml/assets/assets/Application-Cu7lNJmG.css