Class QPool
This class manages pools life cycle: start, monitor, stop.
Inherited Members
Namespace: QarnotSDK
Assembly: QarnotSDK.dll
Syntax
public class QPool : AQPool
Constructors
QPool(Connection, Guid, bool)
Create a pool object given an existing Uuid.
Declaration
public QPool(Connection connection, Guid uuid, bool updateFromApi = false)
Parameters
| Type | Name | Description |
|---|---|---|
| Connection | connection | The inner connection object. |
| Guid | uuid | The Uuid of an already existing pool. |
| bool | updateFromApi | Update the pool from api values (if true, will call compute API to retrieve pool info) |
QPool(Connection, string, string, uint, string, bool?, SchedulingType?)
Create a new pool.
Declaration
public QPool(Connection connection, string name, string profile = null, uint initialNodeCount = 0, string shortname = null, bool? taskDefaultWaitForPoolResourcesSynchronization = null, SchedulingType? schedulingType = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Connection | connection | The inner connection object. |
| string | name | The pool name. |
| string | profile | The pool profile. If not specified, it must be given when the pool is started. |
| uint | initialNodeCount | The number of compute nodes this pool will have. If not specified, it must be given when the pool is started. |
| string | shortname | optional unique friendly shortname of the pool. |
| bool? | taskDefaultWaitForPoolResourcesSynchronization | Default value for task's WaitForPoolResourcesSynchronization, see also TaskDefaultWaitForPoolResourcesSynchronization |
| SchedulingType? | schedulingType | Type of scheduling used for the dispatch of the task |
Properties
AutoDeleteOnCompletion
AutoDeleteOnCompletion: Field allowing the automatic deletion of the pool when in a final state. Must be set before the submission.
Declaration
public bool AutoDeleteOnCompletion { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
CompletionTimeToLive
CompletionTimeToLive: Final State Duration before deletion of the pool. Must be set before the submission.
Declaration
public TimeSpan CompletionTimeToLive { get; set; }
Property Value
| Type | Description |
|---|---|
| TimeSpan |
Constants
The Pool constants.
Declaration
public virtual Dictionary<string, string> Constants { get; }
Property Value
| Type | Description |
|---|---|
| Dictionary<string, string> |
Constraints
The pool constraints.
Declaration
public virtual Dictionary<string, string> Constraints { get; }
Property Value
| Type | Description |
|---|---|
| Dictionary<string, string> |
CreationDate
The pool creation date. Available only after the pool is started.
Declaration
public virtual DateTime CreationDate { get; }
Property Value
| Type | Description |
|---|---|
| DateTime |
DefaultResourcesCacheTTLSec
The default TTL for the pool resources cache.
Declaration
public virtual uint? DefaultResourcesCacheTTLSec { get; set; }
Property Value
| Type | Description |
|---|---|
| uint? |
DefaultRetrySettings
The default retry settings for the pool tasks.
Declaration
public virtual RetrySettings DefaultRetrySettings { get; set; }
Property Value
| Type | Description |
|---|---|
| RetrySettings |
ElasticMaximumTotalNodes
Maximum slot number for the pool in elastic mode
Declaration
[Obsolete("Has been replaced by ElasticMaximumTotalSlots in Elastic settings. But Elastic settings are now deprecated, use scaling configuration instead.", true)]
public virtual uint ElasticMaximumTotalNodes { get; set; }
Property Value
| Type | Description |
|---|---|
| uint |
ElasticMaximumTotalSlots
Maximum slot number for the pool in elastic mode
Declaration
[Obsolete("Use Scaling configuration instead.")]
public virtual uint ElasticMaximumTotalSlots { get; set; }
Property Value
| Type | Description |
|---|---|
| uint |
ElasticMinimumIdlingNodes
Minimum idling slot number.
Declaration
[Obsolete("Has been replaced by ElasticMinimumIdlingSlots in Elastic settings. But Elastic settings are now deprecated, use scaling configuration instead.", true)]
public virtual uint ElasticMinimumIdlingNodes { get; set; }
Property Value
| Type | Description |
|---|---|
| uint |
ElasticMinimumIdlingSlots
Minimum idling slot number.
Declaration
[Obsolete("Use Scaling configuration instead.")]
public virtual uint ElasticMinimumIdlingSlots { get; set; }
Property Value
| Type | Description |
|---|---|
| uint |
ElasticMinimumIdlingTime
Declaration
[Obsolete("Use Scaling configuration instead.")]
public virtual uint ElasticMinimumIdlingTime { get; set; }
Property Value
| Type | Description |
|---|---|
| uint |
ElasticMinimumTotalNodes
Minimum slot number for the pool in elastic mode
Declaration
[Obsolete("Has been replaced by ElasticMinimumTotalSlots in Elastic settings. But Elastic settings are now deprecated, use scaling configuration instead.", true)]
public virtual uint ElasticMinimumTotalNodes { get; set; }
Property Value
| Type | Description |
|---|---|
| uint |
ElasticMinimumTotalSlots
Minimum slot number for the pool in elastic mode
Declaration
[Obsolete("Use Scaling configuration instead.")]
public virtual uint ElasticMinimumTotalSlots { get; set; }
Property Value
| Type | Description |
|---|---|
| uint |
ElasticResizeFactor
Declaration
[Obsolete("Use Scaling configuration instead.")]
public virtual float ElasticResizeFactor { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
ElasticResizePeriod
Declaration
[Obsolete("Use Scaling configuration instead.")]
public virtual uint ElasticResizePeriod { get; set; }
Property Value
| Type | Description |
|---|---|
| uint |
EndDate
The pool end date.
Declaration
public virtual DateTime EndDate { get; }
Property Value
| Type | Description |
|---|---|
| DateTime |
Errors
Retrieve the pool errors.
Declaration
public virtual List<QPoolError> Errors { get; }
Property Value
| Type | Description |
|---|---|
| List<QPoolError> |
ExecutionTime
The pool execution time.
Declaration
public virtual TimeSpan ExecutionTime { get; }
Property Value
| Type | Description |
|---|---|
| TimeSpan |
ForcedConstants
Constant forced for the pool.
Declaration
public virtual List<ForcedConstant> ForcedConstants { get; set; }
Property Value
| Type | Description |
|---|---|
| List<ForcedConstant> |
ForcedNetworkRules
Network rules forced for the pool.
Declaration
public virtual List<ForcedNetworkRule> ForcedNetworkRules { get; set; }
Property Value
| Type | Description |
|---|---|
| List<ForcedNetworkRule> |
HardwareConstraints
The pool hardware constraints list.
Declaration
public virtual HardwareConstraints HardwareConstraints { get; set; }
Property Value
| Type | Description |
|---|---|
| HardwareConstraints |
IsElastic
Allow the automatic resize of the pool
Declaration
[Obsolete("Use Scaling configuration instead.")]
public virtual bool IsElastic { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
Labels
The pool labels.
Declaration
public virtual Dictionary<string, string> Labels { get; }
Property Value
| Type | Description |
|---|---|
| Dictionary<string, string> |
LastModified
The Pool last modified date.
Declaration
public virtual DateTime? LastModified { get; }
Property Value
| Type | Description |
|---|---|
| DateTime? |
Name
The pool name.
Declaration
public virtual string Name { get; }
Property Value
| Type | Description |
|---|---|
| string |
NodeCount
How many nodes this pool has.
Declaration
public virtual uint NodeCount { get; }
Property Value
| Type | Description |
|---|---|
| uint |
PoolUsage
The ratio of dispatched task instances on the slot capacity indicating how much a pool is currently being used. Available only after the submission.
Declaration
public virtual double PoolUsage { get; }
Property Value
| Type | Description |
|---|---|
| double |
PreparationCommandLine
The Pool Preparation Command Line.
Declaration
public virtual string PreparationCommandLine { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
PreviousState
Retrieve the pool previous state (see QPoolStates). Available only after the submission. Use UpdateStatus or UpdateStatusAsync to refresh.
Declaration
public virtual string PreviousState { get; }
Property Value
| Type | Description |
|---|---|
| string |
PreviousStateTransitionTime
Retrieve the pool previous state transition utc-time (see QPoolStates). Available only after the submission. Use UpdateStatus or UpdateStatusAsync to refresh.
Declaration
public virtual DateTime? PreviousStateTransitionTime { get; }
Property Value
| Type | Description |
|---|---|
| DateTime? |
Privileges
The pool privileges list.
Declaration
public virtual Privileges Privileges { get; set; }
Property Value
| Type | Description |
|---|---|
| Privileges |
Profile
The pool profile.
Declaration
public virtual string Profile { get; }
Property Value
| Type | Description |
|---|---|
| string |
QueuedOrRunningTaskInstancesCount
The count of task instances running or enqueued on this pool. Available only after the submission.
Declaration
public virtual int QueuedOrRunningTaskInstancesCount { get; }
Property Value
| Type | Description |
|---|---|
| int |
Resources
Qarnot resources buckets bound to this pool. Can be set only before the pool start.
Declaration
public virtual List<QAbstractStorage> Resources { get; set; }
Property Value
| Type | Description |
|---|---|
| List<QAbstractStorage> |
ResourcesBuckets
Qarnot resources buckets bound to this pool. Can be set only before the pool start.
Declaration
public virtual IEnumerable<QBucket> ResourcesBuckets { get; }
Property Value
| Type | Description |
|---|---|
| IEnumerable<QBucket> |
RunningCoreCount
The actual running cores count.
Declaration
public virtual uint RunningCoreCount { get; }
Property Value
| Type | Description |
|---|---|
| uint |
RunningInstanceCount
The actual running instance count.
Declaration
public virtual uint RunningInstanceCount { get; }
Property Value
| Type | Description |
|---|---|
| uint |
Scaling
Scaling specification for the pool. Mutually exclusive with other elastic properties such as IsElastic, ElasticMinimumTotalNodes
Declaration
public Scaling Scaling { get; set; }
Property Value
| Type | Description |
|---|---|
| Scaling |
SchedulingType
Scheduling type used for the dispatch of the pool.
Declaration
public SchedulingType? SchedulingType { get; set; }
Property Value
| Type | Description |
|---|---|
| SchedulingType? |
Remarks
SecretsAccessRights
Description of the secrets the tasks in this pool will have access to when running.
Declaration
public virtual QSecretAccessRights SecretsAccessRights { get; set; }
Property Value
| Type | Description |
|---|---|
| QSecretAccessRights |
Remarks
Secrets can be accessible either by exact match on the key or by using a prefix in order to match all the secrets starting with said prefix.
Shortname
The pool shortname identifier. The shortname is provided by the user. It has to be unique.
Declaration
public virtual string Shortname { get; }
Property Value
| Type | Description |
|---|---|
| string |
State
Retrieve the pool state (see QPoolStates). Available only after the pool is started. Use UpdateStatus or UpdateStatusAsync to refresh.
Declaration
public virtual string State { get; }
Property Value
| Type | Description |
|---|---|
| string |
StateTransitionTime
Retrieve the pool state transition utc-time (see QPoolStates). Available only after the submission. Use UpdateStatus or UpdateStatusAsync to refresh.
Declaration
public DateTime? StateTransitionTime { get; }
Property Value
| Type | Description |
|---|---|
| DateTime? |
Status
Retrieve the pool detailed status. Available only after the pool is started. Use UpdateStatus or UpdateStatusAsync to refresh.
Declaration
public virtual QPoolStatus Status { get; }
Property Value
| Type | Description |
|---|---|
| QPoolStatus |
Tags
The custom pool tag list.
Declaration
public virtual List<string> Tags { get; }
Property Value
| Type | Description |
|---|---|
| List<string> |
TargetedReservedMachineKey
The key of the reserved machine the pool should be dispatch on.
Declaration
public string TargetedReservedMachineKey { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Remarks
To use with Reserved SchedulingType
TaskDefaultWaitForPoolResourcesSynchronization
Default value of WaitForPoolResourcesSynchronization for pool's tasks
Declaration
public virtual bool? TaskDefaultWaitForPoolResourcesSynchronization { get; }
Property Value
| Type | Description |
|---|---|
| bool? |
TotalSlotCapacity
The slot capacity of this Pool. Representing the slots count for a static pool or the maximum slot count for an elastic pool. Available only after the submission.
Declaration
public virtual int TotalSlotCapacity { get; }
Property Value
| Type | Description |
|---|---|
| int |
WallTime
The pool wall time.
Declaration
public virtual TimeSpan WallTime { get; }
Property Value
| Type | Description |
|---|---|
| TimeSpan |
Methods
AddConstant(string, string)
Deprecated, use SetConstant.
Declaration
[Obsolete("use SetConstant")]
public virtual void AddConstant(string key, string value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | key | Constant name. |
| string | value | Constant value. |
Commit(CancellationToken)
Commit the local pool changes.
Declaration
[Obsolete("Commit is deprecated, please use CommitAsync instead.")]
public virtual void Commit(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken |
CommitAsync(CancellationToken)
Commit the local pool changes.
Declaration
public virtual Task CommitAsync(CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken | Optional token to cancel the request. |
Returns
| Type | Description |
|---|---|
| Task |
Delete(CancellationToken, bool, bool)
Delete the pool. If the pool is running, the pool is closed and deleted.
Declaration
[Obsolete("Delete is deprecated, please use DeleteAsync instead.")]
public override void Delete(CancellationToken cancellationToken = default, bool failIfDoesntExist = false, bool purgeResources = false)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken | Optional token to cancel the request. |
| bool | failIfDoesntExist | If set to false and the pool doesn't exist, no exception is thrown. Default is true. |
| bool | purgeResources | Boolean to trigger all resource storages deletion. Default is false. |
Overrides
DeleteAsync(CancellationToken, bool, bool)
Delete the pool. If the pool is running, the pool is closed and deleted.
Declaration
public override Task DeleteAsync(CancellationToken cancellationToken, bool failIfDoesntExist = false, bool purgeResources = false)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken | Optional token to cancel the request. |
| bool | failIfDoesntExist | If set to false and the pool doesn't exist, no exception is thrown. Default is true. |
| bool | purgeResources | Boolean to trigger all resource storages deletion. Default is false. |
Returns
| Type | Description |
|---|---|
| Task |
Overrides
GetCarbonFactsAsync(string, CancellationToken)
Get the pool carbon facts
Declaration
public virtual Task<CarbonFacts> GetCarbonFactsAsync(string referenceDatacenter = null, CancellationToken ct = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | referenceDatacenter | |
| CancellationToken | ct |
Returns
| Type | Description |
|---|---|
| Task<CarbonFacts> | The carbon facts of the pool. |
GetNodeStatus(uint)
Get the status of a node given its node id. Note: the status of a node could be retrieved in the Status.RunningInstancesInfo.PerRunningInstanceInfo structure. This method provides an easy way to retrieve those information.
Declaration
public virtual QPoolNodeStatus GetNodeStatus(uint nodeId)
Parameters
| Type | Name | Description |
|---|---|---|
| uint | nodeId | The id of the node. |
Returns
| Type | Description |
|---|---|
| QPoolNodeStatus | The status of the node or null if not available. |
GetNodeStatusList()
Get the list of the running nodes status. Note: the status of a node could be retrieved in the Status.RunningInstancesInfo.PerRunningInstanceInfo structure. This method provides an easy way to retrieve those information.
Declaration
public virtual List<QPoolNodeStatus> GetNodeStatusList()
Returns
| Type | Description |
|---|---|
| List<QPoolNodeStatus> | The status list of nodes. |
GetPublicHostForApplicationPort(ushort)
Return the public host and port to establish an inbound connection to the master compute node (node 0) running your pool. Note: your profile have to define one or more inbound connection to support that feature. For example, the profile "docker-network-ssh" defines a redirection to the ssh port 22. If you need inbound connections on a specific port, you can make a request to the support team.
Declaration
public virtual string GetPublicHostForApplicationPort(ushort port)
Parameters
| Type | Name | Description |
|---|---|---|
| ushort | port | The port you want to access on the master compute node (node 0). |
Returns
| Type | Description |
|---|---|
| string | The host and port formated in a string "host:port". |
SetConstant(string, string)
Set a constant. If the constant already exists, it is replaced (or removed if value is null).
Declaration
public virtual void SetConstant(string name, string value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Constant name. |
| string | value | Constant value. If null, the constant is deleted. |
SetConstraint(string, string)
Set a constraint. If the constraint already exists, it is replaced (or removed if value is null).
Declaration
public virtual void SetConstraint(string name, string value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Constraint name. |
| string | value | Constraint value. If null, the constraint is deleted. |
SetLabel(string, string)
Set a label. If the label already exists, it is replaced (or removed if value is null).
Declaration
public virtual void SetLabel(string name, string value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Label name. |
| string | value | Label value. If null, the label is deleted. |
SetPreparationTask(PoolPreparationTask)
Set a new preparation Task.
Declaration
public virtual void SetPreparationTask(PoolPreparationTask preparationTask)
Parameters
| Type | Name | Description |
|---|---|---|
| PoolPreparationTask | preparationTask | Pool Preparation Task. |
SetTags(params string[])
Set the a list of tags for the pool.
Declaration
public virtual void SetTags(params string[] tags)
Parameters
| Type | Name | Description |
|---|---|---|
| string[] | tags | Pool tags. |
Start(string, uint)
Start the pool.
Declaration
[Obsolete("Start is deprecated, please use StartAsync instead.")]
public virtual void Start(string profile = null, uint initialNodeCount = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| string | profile | The pool profile. Optional if it has already been defined in the constructor. |
| uint | initialNodeCount | The number of compute nodes this pool will have. Optional if it has already been defined in the constructor. |
Start(CancellationToken, string, uint)
Start the pool.
Declaration
[Obsolete("Start is deprecated, please use StartAsync instead.")]
public virtual void Start(CancellationToken cancellationToken, string profile = null, uint initialNodeCount = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken | Optional token to cancel the request. |
| string | profile | The pool profile. Optional if it has already been defined in the constructor. |
| uint | initialNodeCount | The number of compute nodes this pool will have. Optional if it has already been defined in the constructor. |
StartAsync(string, uint)
Start the pool.
Declaration
public virtual Task StartAsync(string profile = null, uint initialNodeCount = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| string | profile | The pool profile. Optional if it has already been defined in the constructor. |
| uint | initialNodeCount | The number of compute nodes this pool will have. Optional if it has already been defined in the constructor. |
Returns
| Type | Description |
|---|---|
| Task |
StartAsync(CancellationToken, string, uint)
Start the pool.
Declaration
public virtual Task StartAsync(CancellationToken cancellationToken, string profile = null, uint initialNodeCount = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken | Optional token to cancel the request. |
| string | profile | The pool profile. Optional if it has already been defined in the constructor. |
| uint | initialNodeCount | The number of compute nodes this pool will have. Optional if it has already been defined in the constructor. |
Returns
| Type | Description |
|---|---|
| Task |
UpdateScalingAsync(Scaling, CancellationToken)
Commit the local pool changes.
Declaration
public virtual Task UpdateScalingAsync(Scaling newScaling, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| Scaling | newScaling | The new Scaling specification to which you want to update |
| CancellationToken | cancellationToken | Optional token to cancel the request |
Returns
| Type | Description |
|---|---|
| Task |
UpdateStatus(bool)
Update this pool state and status.
Declaration
[Obsolete("UpdateStatus is deprecated, please use UpdateStatusAsync instead.")]
public virtual void UpdateStatus(bool updateQBucketsInfo = false)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | updateQBucketsInfo | If set to true, the resources bucket objects are also updated. |
UpdateStatus(CancellationToken, bool)
Update this pool state and status.
Declaration
[Obsolete("UpdateStatus is deprecated, please use UpdateStatusAsync instead.")]
public virtual void UpdateStatus(CancellationToken cancellationToken, bool updateQBucketsInfo = false)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken | Optional token to cancel the request. |
| bool | updateQBucketsInfo | If set to true, the resources bucket objects are also updated. |
UpdateStatusAsync(bool)
Update this pool state and status.
Declaration
public virtual Task UpdateStatusAsync(bool updateQBucketsInfo = false)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | updateQBucketsInfo | If set to true, the resources qbucket objects are also updated. |
Returns
| Type | Description |
|---|---|
| Task |
UpdateStatusAsync(CancellationToken, bool)
Update this pool state and status.
Declaration
public virtual Task UpdateStatusAsync(CancellationToken cancellationToken, bool updateQBucketsInfo = false)
Parameters
| Type | Name | Description |
|---|---|---|
| CancellationToken | cancellationToken | Optional token to cancel the request. |
| bool | updateQBucketsInfo | If set to true, the resources bucket objects are also updated. |
Returns
| Type | Description |
|---|---|
| Task |