github.com/filecoin-project/bacalhau@v0.3.23-0.20230228154132-45c989550ace/clients/python/bacalhau_apiclient/models/shard_state.py (about) 1 # coding: utf-8 2 3 """ 4 Bacalhau API 5 6 This page is the reference of the Bacalhau REST API. Project docs are available at https://docs.bacalhau.org/. Find more information about Bacalhau at https://github.com/filecoin-project/bacalhau. # noqa: E501 7 8 OpenAPI spec version: 0.3.22.post4 9 Contact: team@bacalhau.org 10 Generated by: https://github.com/swagger-api/swagger-codegen.git 11 """ 12 13 14 import pprint 15 import re # noqa: F401 16 17 import six 18 19 from bacalhau_apiclient.configuration import Configuration 20 21 22 class ShardState(object): 23 """NOTE: This class is auto generated by the swagger code generator program. 24 25 Do not edit the class manually. 26 """ 27 28 """ 29 Attributes: 30 swagger_types (dict): The key is attribute name 31 and the value is attribute type. 32 attribute_map (dict): The key is attribute name 33 and the value is json key in definition. 34 """ 35 swagger_types = { 36 'create_time': 'str', 37 'executions': 'list[ExecutionState]', 38 'job_id': 'str', 39 'shard_index': 'int', 40 'state': 'ShardStateState', 41 'update_time': 'str', 42 'version': 'int' 43 } 44 45 attribute_map = { 46 'create_time': 'CreateTime', 47 'executions': 'Executions', 48 'job_id': 'JobID', 49 'shard_index': 'ShardIndex', 50 'state': 'State', 51 'update_time': 'UpdateTime', 52 'version': 'Version' 53 } 54 55 def __init__(self, create_time=None, executions=None, job_id=None, shard_index=None, state=None, update_time=None, version=None, _configuration=None): # noqa: E501 56 """ShardState - a model defined in Swagger""" # noqa: E501 57 if _configuration is None: 58 _configuration = Configuration() 59 self._configuration = _configuration 60 61 self._create_time = None 62 self._executions = None 63 self._job_id = None 64 self._shard_index = None 65 self._state = None 66 self._update_time = None 67 self._version = None 68 self.discriminator = None 69 70 if create_time is not None: 71 self.create_time = create_time 72 if executions is not None: 73 self.executions = executions 74 if job_id is not None: 75 self.job_id = job_id 76 if shard_index is not None: 77 self.shard_index = shard_index 78 if state is not None: 79 self.state = state 80 if update_time is not None: 81 self.update_time = update_time 82 if version is not None: 83 self.version = version 84 85 @property 86 def create_time(self): 87 """Gets the create_time of this ShardState. # noqa: E501 88 89 CreateTime is the time when the shard was created, which is the same as the job creation time. # noqa: E501 90 91 :return: The create_time of this ShardState. # noqa: E501 92 :rtype: str 93 """ 94 return self._create_time 95 96 @create_time.setter 97 def create_time(self, create_time): 98 """Sets the create_time of this ShardState. 99 100 CreateTime is the time when the shard was created, which is the same as the job creation time. # noqa: E501 101 102 :param create_time: The create_time of this ShardState. # noqa: E501 103 :type: str 104 """ 105 106 self._create_time = create_time 107 108 @property 109 def executions(self): 110 """Gets the executions of this ShardState. # noqa: E501 111 112 Executions is a list of executions of the shard across the nodes. A new execution is created when a node is selected to execute the shard, and a node can have multiple executions for the same shard due to retries, but there can only be a single active execution per node at any given time. # noqa: E501 113 114 :return: The executions of this ShardState. # noqa: E501 115 :rtype: list[ExecutionState] 116 """ 117 return self._executions 118 119 @executions.setter 120 def executions(self, executions): 121 """Sets the executions of this ShardState. 122 123 Executions is a list of executions of the shard across the nodes. A new execution is created when a node is selected to execute the shard, and a node can have multiple executions for the same shard due to retries, but there can only be a single active execution per node at any given time. # noqa: E501 124 125 :param executions: The executions of this ShardState. # noqa: E501 126 :type: list[ExecutionState] 127 """ 128 129 self._executions = executions 130 131 @property 132 def job_id(self): 133 """Gets the job_id of this ShardState. # noqa: E501 134 135 JobID is the unique identifier for the job # noqa: E501 136 137 :return: The job_id of this ShardState. # noqa: E501 138 :rtype: str 139 """ 140 return self._job_id 141 142 @job_id.setter 143 def job_id(self, job_id): 144 """Sets the job_id of this ShardState. 145 146 JobID is the unique identifier for the job # noqa: E501 147 148 :param job_id: The job_id of this ShardState. # noqa: E501 149 :type: str 150 """ 151 152 self._job_id = job_id 153 154 @property 155 def shard_index(self): 156 """Gets the shard_index of this ShardState. # noqa: E501 157 158 ShardIndex is the index of the shard in the job # noqa: E501 159 160 :return: The shard_index of this ShardState. # noqa: E501 161 :rtype: int 162 """ 163 return self._shard_index 164 165 @shard_index.setter 166 def shard_index(self, shard_index): 167 """Sets the shard_index of this ShardState. 168 169 ShardIndex is the index of the shard in the job # noqa: E501 170 171 :param shard_index: The shard_index of this ShardState. # noqa: E501 172 :type: int 173 """ 174 175 self._shard_index = shard_index 176 177 @property 178 def state(self): 179 """Gets the state of this ShardState. # noqa: E501 180 181 182 :return: The state of this ShardState. # noqa: E501 183 :rtype: ShardStateState 184 """ 185 return self._state 186 187 @state.setter 188 def state(self, state): 189 """Sets the state of this ShardState. 190 191 192 :param state: The state of this ShardState. # noqa: E501 193 :type: ShardStateState 194 """ 195 196 self._state = state 197 198 @property 199 def update_time(self): 200 """Gets the update_time of this ShardState. # noqa: E501 201 202 UpdateTime is the time when the shard state was last updated. # noqa: E501 203 204 :return: The update_time of this ShardState. # noqa: E501 205 :rtype: str 206 """ 207 return self._update_time 208 209 @update_time.setter 210 def update_time(self, update_time): 211 """Sets the update_time of this ShardState. 212 213 UpdateTime is the time when the shard state was last updated. # noqa: E501 214 215 :param update_time: The update_time of this ShardState. # noqa: E501 216 :type: str 217 """ 218 219 self._update_time = update_time 220 221 @property 222 def version(self): 223 """Gets the version of this ShardState. # noqa: E501 224 225 Version is the version of the shard state. It is incremented every time the shard state is updated. # noqa: E501 226 227 :return: The version of this ShardState. # noqa: E501 228 :rtype: int 229 """ 230 return self._version 231 232 @version.setter 233 def version(self, version): 234 """Sets the version of this ShardState. 235 236 Version is the version of the shard state. It is incremented every time the shard state is updated. # noqa: E501 237 238 :param version: The version of this ShardState. # noqa: E501 239 :type: int 240 """ 241 242 self._version = version 243 244 def to_dict(self): 245 """Returns the model properties as a dict""" 246 result = {} 247 248 for attr, _ in six.iteritems(self.swagger_types): 249 value = getattr(self, attr) 250 if isinstance(value, list): 251 result[attr] = list(map( 252 lambda x: x.to_dict() if hasattr(x, "to_dict") else x, 253 value 254 )) 255 elif hasattr(value, "to_dict"): 256 result[attr] = value.to_dict() 257 elif isinstance(value, dict): 258 result[attr] = dict(map( 259 lambda item: (item[0], item[1].to_dict()) 260 if hasattr(item[1], "to_dict") else item, 261 value.items() 262 )) 263 else: 264 result[attr] = value 265 if issubclass(ShardState, dict): 266 for key, value in self.items(): 267 result[key] = value 268 269 return result 270 271 def to_str(self): 272 """Returns the string representation of the model""" 273 return pprint.pformat(self.to_dict()) 274 275 def __repr__(self): 276 """For `print` and `pprint`""" 277 return self.to_str() 278 279 def __eq__(self, other): 280 """Returns true if both objects are equal""" 281 if not isinstance(other, ShardState): 282 return False 283 284 return self.to_dict() == other.to_dict() 285 286 def __ne__(self, other): 287 """Returns true if both objects are not equal""" 288 if not isinstance(other, ShardState): 289 return True 290 291 return self.to_dict() != other.to_dict()