Sha256: 67b5296f4c02f9658b7ea196f4857b94fbcfff0b9c684f2226d7d140b9b526cf

Contents?: true

Size: 944 Bytes

Versions: 27

Compression:

Stored size: 944 Bytes

Contents

require "jsonapi/serializer"

module EasyML
  class RetrainingRunSerializer
    include JSONAPI::Serializer

    attributes :id,
               :deployable,
               :metrics,
               :metric_value,
               :threshold,
               :threshold_direction,
               :status,
               :error_message,
               :is_deploying,
               :deployed

    attribute :metrics_url do |run|
      run.wandb_url
    end

    attribute :started_at do |run|
      run.started_at&.in_time_zone(EasyML::Configuration.timezone)
    end

    attribute :completed_at do |run|
      run.completed_at&.in_time_zone(EasyML::Configuration.timezone)
    end

    attribute :stacktrace do |object|
      if object.status.to_s == "running"
        nil
      else
        last_event = object.events.order(id: :desc).limit(1).last
        last_event&.stacktrace if last_event&.status.to_s == "failed"
      end
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
easy_ml-0.2.0.pre.rc27 app/serializers/easy_ml/retraining_run_serializer.rb
easy_ml-0.2.0.pre.rc26 app/serializers/easy_ml/retraining_run_serializer.rb
easy_ml-0.2.0.pre.rc25 app/serializers/easy_ml/retraining_run_serializer.rb
easy_ml-0.2.0.pre.rc24 app/serializers/easy_ml/retraining_run_serializer.rb
easy_ml-0.2.0.pre.rc23 app/serializers/easy_ml/retraining_run_serializer.rb
easy_ml-0.2.0.pre.rc22 app/serializers/easy_ml/retraining_run_serializer.rb
easy_ml-0.2.0.pre.rc21 app/serializers/easy_ml/retraining_run_serializer.rb
easy_ml-0.2.0.pre.rc20 app/serializers/easy_ml/retraining_run_serializer.rb
easy_ml-0.2.0.pre.rc19 app/serializers/easy_ml/retraining_run_serializer.rb
easy_ml-0.2.0.pre.rc18 app/serializers/easy_ml/retraining_run_serializer.rb
easy_ml-0.2.0.pre.rc17 app/serializers/easy_ml/retraining_run_serializer.rb
easy_ml-0.2.0.pre.rc16 app/serializers/easy_ml/retraining_run_serializer.rb
easy_ml-0.2.0.pre.rc15 app/serializers/easy_ml/retraining_run_serializer.rb
easy_ml-0.2.0.pre.rc14 app/serializers/easy_ml/retraining_run_serializer.rb
easy_ml-0.2.0.pre.rc13 app/serializers/easy_ml/retraining_run_serializer.rb
easy_ml-0.2.0.pre.rc12 app/serializers/easy_ml/retraining_run_serializer.rb
easy_ml-0.2.0.pre.rc11 app/serializers/easy_ml/retraining_run_serializer.rb
easy_ml-0.2.0.pre.rc10 app/serializers/easy_ml/retraining_run_serializer.rb
easy_ml-0.2.0.pre.rc9 app/serializers/easy_ml/retraining_run_serializer.rb
easy_ml-0.2.0.pre.rc8 app/serializers/easy_ml/retraining_run_serializer.rb