{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.SageMaker.Types.TrainingJobStatusCounters
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.SageMaker.Types.TrainingJobStatusCounters where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The numbers of training jobs launched by a hyperparameter tuning job,
-- categorized by status.
--
-- /See:/ 'newTrainingJobStatusCounters' smart constructor.
data TrainingJobStatusCounters = TrainingJobStatusCounters'
  { -- | The number of training jobs launched by a hyperparameter tuning job that
    -- were manually stopped.
    TrainingJobStatusCounters -> Maybe Natural
stopped :: Prelude.Maybe Prelude.Natural,
    -- | The number of training jobs that failed, but can be retried. A failed
    -- training job can be retried only if it failed because an internal
    -- service error occurred.
    TrainingJobStatusCounters -> Maybe Natural
retryableError :: Prelude.Maybe Prelude.Natural,
    -- | The number of in-progress training jobs launched by a hyperparameter
    -- tuning job.
    TrainingJobStatusCounters -> Maybe Natural
inProgress :: Prelude.Maybe Prelude.Natural,
    -- | The number of training jobs that failed and can\'t be retried. A failed
    -- training job can\'t be retried if it failed because a client error
    -- occurred.
    TrainingJobStatusCounters -> Maybe Natural
nonRetryableError :: Prelude.Maybe Prelude.Natural,
    -- | The number of completed training jobs launched by the hyperparameter
    -- tuning job.
    TrainingJobStatusCounters -> Maybe Natural
completed :: Prelude.Maybe Prelude.Natural
  }
  deriving (TrainingJobStatusCounters -> TrainingJobStatusCounters -> Bool
(TrainingJobStatusCounters -> TrainingJobStatusCounters -> Bool)
-> (TrainingJobStatusCounters -> TrainingJobStatusCounters -> Bool)
-> Eq TrainingJobStatusCounters
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TrainingJobStatusCounters -> TrainingJobStatusCounters -> Bool
$c/= :: TrainingJobStatusCounters -> TrainingJobStatusCounters -> Bool
== :: TrainingJobStatusCounters -> TrainingJobStatusCounters -> Bool
$c== :: TrainingJobStatusCounters -> TrainingJobStatusCounters -> Bool
Prelude.Eq, ReadPrec [TrainingJobStatusCounters]
ReadPrec TrainingJobStatusCounters
Int -> ReadS TrainingJobStatusCounters
ReadS [TrainingJobStatusCounters]
(Int -> ReadS TrainingJobStatusCounters)
-> ReadS [TrainingJobStatusCounters]
-> ReadPrec TrainingJobStatusCounters
-> ReadPrec [TrainingJobStatusCounters]
-> Read TrainingJobStatusCounters
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TrainingJobStatusCounters]
$creadListPrec :: ReadPrec [TrainingJobStatusCounters]
readPrec :: ReadPrec TrainingJobStatusCounters
$creadPrec :: ReadPrec TrainingJobStatusCounters
readList :: ReadS [TrainingJobStatusCounters]
$creadList :: ReadS [TrainingJobStatusCounters]
readsPrec :: Int -> ReadS TrainingJobStatusCounters
$creadsPrec :: Int -> ReadS TrainingJobStatusCounters
Prelude.Read, Int -> TrainingJobStatusCounters -> ShowS
[TrainingJobStatusCounters] -> ShowS
TrainingJobStatusCounters -> String
(Int -> TrainingJobStatusCounters -> ShowS)
-> (TrainingJobStatusCounters -> String)
-> ([TrainingJobStatusCounters] -> ShowS)
-> Show TrainingJobStatusCounters
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TrainingJobStatusCounters] -> ShowS
$cshowList :: [TrainingJobStatusCounters] -> ShowS
show :: TrainingJobStatusCounters -> String
$cshow :: TrainingJobStatusCounters -> String
showsPrec :: Int -> TrainingJobStatusCounters -> ShowS
$cshowsPrec :: Int -> TrainingJobStatusCounters -> ShowS
Prelude.Show, (forall x.
 TrainingJobStatusCounters -> Rep TrainingJobStatusCounters x)
-> (forall x.
    Rep TrainingJobStatusCounters x -> TrainingJobStatusCounters)
-> Generic TrainingJobStatusCounters
forall x.
Rep TrainingJobStatusCounters x -> TrainingJobStatusCounters
forall x.
TrainingJobStatusCounters -> Rep TrainingJobStatusCounters x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep TrainingJobStatusCounters x -> TrainingJobStatusCounters
$cfrom :: forall x.
TrainingJobStatusCounters -> Rep TrainingJobStatusCounters x
Prelude.Generic)

-- |
-- Create a value of 'TrainingJobStatusCounters' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'stopped', 'trainingJobStatusCounters_stopped' - The number of training jobs launched by a hyperparameter tuning job that
-- were manually stopped.
--
-- 'retryableError', 'trainingJobStatusCounters_retryableError' - The number of training jobs that failed, but can be retried. A failed
-- training job can be retried only if it failed because an internal
-- service error occurred.
--
-- 'inProgress', 'trainingJobStatusCounters_inProgress' - The number of in-progress training jobs launched by a hyperparameter
-- tuning job.
--
-- 'nonRetryableError', 'trainingJobStatusCounters_nonRetryableError' - The number of training jobs that failed and can\'t be retried. A failed
-- training job can\'t be retried if it failed because a client error
-- occurred.
--
-- 'completed', 'trainingJobStatusCounters_completed' - The number of completed training jobs launched by the hyperparameter
-- tuning job.
newTrainingJobStatusCounters ::
  TrainingJobStatusCounters
newTrainingJobStatusCounters :: TrainingJobStatusCounters
newTrainingJobStatusCounters =
  TrainingJobStatusCounters' :: Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> TrainingJobStatusCounters
TrainingJobStatusCounters'
    { $sel:stopped:TrainingJobStatusCounters' :: Maybe Natural
stopped =
        Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:retryableError:TrainingJobStatusCounters' :: Maybe Natural
retryableError = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:inProgress:TrainingJobStatusCounters' :: Maybe Natural
inProgress = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:nonRetryableError:TrainingJobStatusCounters' :: Maybe Natural
nonRetryableError = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:completed:TrainingJobStatusCounters' :: Maybe Natural
completed = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | The number of training jobs launched by a hyperparameter tuning job that
-- were manually stopped.
trainingJobStatusCounters_stopped :: Lens.Lens' TrainingJobStatusCounters (Prelude.Maybe Prelude.Natural)
trainingJobStatusCounters_stopped :: (Maybe Natural -> f (Maybe Natural))
-> TrainingJobStatusCounters -> f TrainingJobStatusCounters
trainingJobStatusCounters_stopped = (TrainingJobStatusCounters -> Maybe Natural)
-> (TrainingJobStatusCounters
    -> Maybe Natural -> TrainingJobStatusCounters)
-> Lens
     TrainingJobStatusCounters
     TrainingJobStatusCounters
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TrainingJobStatusCounters' {Maybe Natural
stopped :: Maybe Natural
$sel:stopped:TrainingJobStatusCounters' :: TrainingJobStatusCounters -> Maybe Natural
stopped} -> Maybe Natural
stopped) (\s :: TrainingJobStatusCounters
s@TrainingJobStatusCounters' {} Maybe Natural
a -> TrainingJobStatusCounters
s {$sel:stopped:TrainingJobStatusCounters' :: Maybe Natural
stopped = Maybe Natural
a} :: TrainingJobStatusCounters)

-- | The number of training jobs that failed, but can be retried. A failed
-- training job can be retried only if it failed because an internal
-- service error occurred.
trainingJobStatusCounters_retryableError :: Lens.Lens' TrainingJobStatusCounters (Prelude.Maybe Prelude.Natural)
trainingJobStatusCounters_retryableError :: (Maybe Natural -> f (Maybe Natural))
-> TrainingJobStatusCounters -> f TrainingJobStatusCounters
trainingJobStatusCounters_retryableError = (TrainingJobStatusCounters -> Maybe Natural)
-> (TrainingJobStatusCounters
    -> Maybe Natural -> TrainingJobStatusCounters)
-> Lens
     TrainingJobStatusCounters
     TrainingJobStatusCounters
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TrainingJobStatusCounters' {Maybe Natural
retryableError :: Maybe Natural
$sel:retryableError:TrainingJobStatusCounters' :: TrainingJobStatusCounters -> Maybe Natural
retryableError} -> Maybe Natural
retryableError) (\s :: TrainingJobStatusCounters
s@TrainingJobStatusCounters' {} Maybe Natural
a -> TrainingJobStatusCounters
s {$sel:retryableError:TrainingJobStatusCounters' :: Maybe Natural
retryableError = Maybe Natural
a} :: TrainingJobStatusCounters)

-- | The number of in-progress training jobs launched by a hyperparameter
-- tuning job.
trainingJobStatusCounters_inProgress :: Lens.Lens' TrainingJobStatusCounters (Prelude.Maybe Prelude.Natural)
trainingJobStatusCounters_inProgress :: (Maybe Natural -> f (Maybe Natural))
-> TrainingJobStatusCounters -> f TrainingJobStatusCounters
trainingJobStatusCounters_inProgress = (TrainingJobStatusCounters -> Maybe Natural)
-> (TrainingJobStatusCounters
    -> Maybe Natural -> TrainingJobStatusCounters)
-> Lens
     TrainingJobStatusCounters
     TrainingJobStatusCounters
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TrainingJobStatusCounters' {Maybe Natural
inProgress :: Maybe Natural
$sel:inProgress:TrainingJobStatusCounters' :: TrainingJobStatusCounters -> Maybe Natural
inProgress} -> Maybe Natural
inProgress) (\s :: TrainingJobStatusCounters
s@TrainingJobStatusCounters' {} Maybe Natural
a -> TrainingJobStatusCounters
s {$sel:inProgress:TrainingJobStatusCounters' :: Maybe Natural
inProgress = Maybe Natural
a} :: TrainingJobStatusCounters)

-- | The number of training jobs that failed and can\'t be retried. A failed
-- training job can\'t be retried if it failed because a client error
-- occurred.
trainingJobStatusCounters_nonRetryableError :: Lens.Lens' TrainingJobStatusCounters (Prelude.Maybe Prelude.Natural)
trainingJobStatusCounters_nonRetryableError :: (Maybe Natural -> f (Maybe Natural))
-> TrainingJobStatusCounters -> f TrainingJobStatusCounters
trainingJobStatusCounters_nonRetryableError = (TrainingJobStatusCounters -> Maybe Natural)
-> (TrainingJobStatusCounters
    -> Maybe Natural -> TrainingJobStatusCounters)
-> Lens
     TrainingJobStatusCounters
     TrainingJobStatusCounters
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TrainingJobStatusCounters' {Maybe Natural
nonRetryableError :: Maybe Natural
$sel:nonRetryableError:TrainingJobStatusCounters' :: TrainingJobStatusCounters -> Maybe Natural
nonRetryableError} -> Maybe Natural
nonRetryableError) (\s :: TrainingJobStatusCounters
s@TrainingJobStatusCounters' {} Maybe Natural
a -> TrainingJobStatusCounters
s {$sel:nonRetryableError:TrainingJobStatusCounters' :: Maybe Natural
nonRetryableError = Maybe Natural
a} :: TrainingJobStatusCounters)

-- | The number of completed training jobs launched by the hyperparameter
-- tuning job.
trainingJobStatusCounters_completed :: Lens.Lens' TrainingJobStatusCounters (Prelude.Maybe Prelude.Natural)
trainingJobStatusCounters_completed :: (Maybe Natural -> f (Maybe Natural))
-> TrainingJobStatusCounters -> f TrainingJobStatusCounters
trainingJobStatusCounters_completed = (TrainingJobStatusCounters -> Maybe Natural)
-> (TrainingJobStatusCounters
    -> Maybe Natural -> TrainingJobStatusCounters)
-> Lens
     TrainingJobStatusCounters
     TrainingJobStatusCounters
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TrainingJobStatusCounters' {Maybe Natural
completed :: Maybe Natural
$sel:completed:TrainingJobStatusCounters' :: TrainingJobStatusCounters -> Maybe Natural
completed} -> Maybe Natural
completed) (\s :: TrainingJobStatusCounters
s@TrainingJobStatusCounters' {} Maybe Natural
a -> TrainingJobStatusCounters
s {$sel:completed:TrainingJobStatusCounters' :: Maybe Natural
completed = Maybe Natural
a} :: TrainingJobStatusCounters)

instance Core.FromJSON TrainingJobStatusCounters where
  parseJSON :: Value -> Parser TrainingJobStatusCounters
parseJSON =
    String
-> (Object -> Parser TrainingJobStatusCounters)
-> Value
-> Parser TrainingJobStatusCounters
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"TrainingJobStatusCounters"
      ( \Object
x ->
          Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> Maybe Natural
-> TrainingJobStatusCounters
TrainingJobStatusCounters'
            (Maybe Natural
 -> Maybe Natural
 -> Maybe Natural
 -> Maybe Natural
 -> Maybe Natural
 -> TrainingJobStatusCounters)
-> Parser (Maybe Natural)
-> Parser
     (Maybe Natural
      -> Maybe Natural
      -> Maybe Natural
      -> Maybe Natural
      -> TrainingJobStatusCounters)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Stopped")
            Parser
  (Maybe Natural
   -> Maybe Natural
   -> Maybe Natural
   -> Maybe Natural
   -> TrainingJobStatusCounters)
-> Parser (Maybe Natural)
-> Parser
     (Maybe Natural
      -> Maybe Natural -> Maybe Natural -> TrainingJobStatusCounters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"RetryableError")
            Parser
  (Maybe Natural
   -> Maybe Natural -> Maybe Natural -> TrainingJobStatusCounters)
-> Parser (Maybe Natural)
-> Parser
     (Maybe Natural -> Maybe Natural -> TrainingJobStatusCounters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"InProgress")
            Parser
  (Maybe Natural -> Maybe Natural -> TrainingJobStatusCounters)
-> Parser (Maybe Natural)
-> Parser (Maybe Natural -> TrainingJobStatusCounters)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"NonRetryableError")
            Parser (Maybe Natural -> TrainingJobStatusCounters)
-> Parser (Maybe Natural) -> Parser TrainingJobStatusCounters
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Natural)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Completed")
      )

instance Prelude.Hashable TrainingJobStatusCounters

instance Prelude.NFData TrainingJobStatusCounters