# coding: utf-8

"""
    Slurm Rest API

    API to access and control Slurm.

    The version of the OpenAPI document: 0.0.38
    Contact: sales@schedmd.com
    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""  # noqa: E501


from __future__ import annotations
import pprint
import re  # noqa: F401
import json


from typing import Any, ClassVar, Dict, List, Optional, Union
from pydantic import BaseModel, StrictBool, StrictFloat, StrictInt, StrictStr
from pydantic import Field
from openapi_client.models.v0038_job_resources import V0038JobResources
try:
    from typing import Self
except ImportError:
    from typing_extensions import Self

class V0038JobResponseProperties(BaseModel):
    """
    V0038JobResponseProperties
    """ # noqa: E501
    account: Optional[StrictStr] = Field(default=None, description="Charge resources used by this job to specified account")
    accrue_time: Optional[StrictInt] = Field(default=None, description="time job is eligible for running")
    admin_comment: Optional[StrictStr] = Field(default=None, description="administrator's arbitrary comment")
    array_job_id: Optional[StrictInt] = Field(default=None, description="job_id of a job array or 0 if N/A")
    array_task_id: Optional[StrictInt] = Field(default=None, description="task_id of a job array")
    array_max_tasks: Optional[StrictInt] = Field(default=None, description="Maximum number of running array tasks")
    array_task_string: Optional[StrictStr] = Field(default=None, description="string expression of task IDs in this record")
    association_id: Optional[StrictInt] = Field(default=None, description="association id for job")
    batch_features: Optional[StrictStr] = Field(default=None, description="features required for batch script's node")
    batch_flag: Optional[StrictBool] = Field(default=None, description="if batch: queued job with script")
    batch_host: Optional[StrictStr] = Field(default=None, description="name of host running batch script")
    flags: Optional[List[StrictStr]] = Field(default=None, description="Job flags")
    burst_buffer: Optional[StrictStr] = Field(default=None, description="burst buffer specifications")
    burst_buffer_state: Optional[StrictStr] = Field(default=None, description="burst buffer state info")
    cluster: Optional[StrictStr] = Field(default=None, description="name of cluster that the job is on")
    cluster_features: Optional[StrictStr] = Field(default=None, description="comma separated list of required cluster features")
    command: Optional[StrictStr] = Field(default=None, description="command to be executed")
    comment: Optional[StrictStr] = Field(default=None, description="arbitrary comment")
    container: Optional[StrictStr] = Field(default=None, description="absolute path to OCI container bundle")
    contiguous: Optional[StrictBool] = Field(default=None, description="job requires contiguous nodes")
    core_spec: Optional[StrictStr] = Field(default=None, description="specialized core count")
    thread_spec: Optional[StrictStr] = Field(default=None, description="specialized thread count")
    cores_per_socket: Optional[StrictStr] = Field(default=None, description="cores per socket required by job")
    billable_tres: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="billable TRES")
    cpus_per_task: Optional[StrictStr] = Field(default=None, description="number of processors required for each task")
    cpu_frequency_minimum: Optional[StrictStr] = Field(default=None, description="Minimum cpu frequency")
    cpu_frequency_maximum: Optional[StrictStr] = Field(default=None, description="Maximum cpu frequency")
    cpu_frequency_governor: Optional[StrictStr] = Field(default=None, description="cpu frequency governor")
    cpus_per_tres: Optional[StrictStr] = Field(default=None, description="semicolon delimited list of TRES=# values")
    deadline: Optional[StrictInt] = Field(default=None, description="job start deadline ")
    delay_boot: Optional[StrictInt] = Field(default=None, description="command to be executed")
    dependency: Optional[StrictStr] = Field(default=None, description="synchronize job execution with other jobs")
    derived_exit_code: Optional[StrictInt] = Field(default=None, description="highest exit code of all job steps")
    eligible_time: Optional[StrictInt] = Field(default=None, description="time job is eligible for running")
    end_time: Optional[StrictInt] = Field(default=None, description="time of termination, actual or expected")
    excluded_nodes: Optional[StrictStr] = Field(default=None, description="comma separated list of excluded nodes")
    exit_code: Optional[StrictInt] = Field(default=None, description="exit code for job")
    features: Optional[StrictStr] = Field(default=None, description="comma separated list of required features")
    federation_origin: Optional[StrictStr] = Field(default=None, description="Origin cluster's name")
    federation_siblings_active: Optional[StrictStr] = Field(default=None, description="string of active sibling names")
    federation_siblings_viable: Optional[StrictStr] = Field(default=None, description="string of viable sibling names")
    gres_detail: Optional[List[StrictStr]] = Field(default=None, description="Job flags")
    group_id: Optional[StrictInt] = Field(default=None, description="group job submitted as")
    job_id: Optional[StrictInt] = Field(default=None, description="job ID")
    job_resources: Optional[V0038JobResources] = None
    job_state: Optional[StrictStr] = Field(default=None, description="state of the job")
    last_sched_evaluation: Optional[StrictInt] = Field(default=None, description="last time job was evaluated for scheduling")
    licenses: Optional[StrictStr] = Field(default=None, description="licenses required by the job")
    max_cpus: Optional[StrictInt] = Field(default=None, description="maximum number of cpus usable by job")
    max_nodes: Optional[StrictInt] = Field(default=None, description="maximum number of nodes usable by job")
    mcs_label: Optional[StrictStr] = Field(default=None, description="mcs_label if mcs plugin in use")
    memory_per_tres: Optional[StrictStr] = Field(default=None, description="semicolon delimited list of TRES=# values")
    name: Optional[StrictStr] = Field(default=None, description="name of the job")
    nodes: Optional[StrictStr] = Field(default=None, description="list of nodes allocated to job")
    nice: Optional[StrictInt] = Field(default=None, description="requested priority change")
    tasks_per_core: Optional[StrictInt] = Field(default=None, description="number of tasks to invoke on each core")
    tasks_per_socket: Optional[StrictInt] = Field(default=None, description="number of tasks to invoke on each socket")
    tasks_per_board: Optional[StrictInt] = Field(default=None, description="number of tasks to invoke on each board")
    cpus: Optional[StrictInt] = Field(default=None, description="minimum number of cpus required by job")
    node_count: Optional[StrictInt] = Field(default=None, description="minimum number of nodes required by job")
    tasks: Optional[StrictInt] = Field(default=None, description="requested task count")
    het_job_id: Optional[StrictInt] = Field(default=None, description="job ID of hetjob leader")
    het_job_id_set: Optional[StrictStr] = Field(default=None, description="job IDs for all components")
    het_job_offset: Optional[StrictInt] = Field(default=None, description="HetJob component offset from leader")
    partition: Optional[StrictStr] = Field(default=None, description="name of assigned partition")
    memory_per_node: Optional[StrictInt] = Field(default=None, description="minimum real memory per node")
    memory_per_cpu: Optional[StrictInt] = Field(default=None, description="minimum real memory per cpu")
    minimum_cpus_per_node: Optional[StrictInt] = Field(default=None, description="minimum # CPUs per node")
    minimum_tmp_disk_per_node: Optional[StrictInt] = Field(default=None, description="minimum tmp disk per node")
    preempt_time: Optional[StrictInt] = Field(default=None, description="preemption signal time")
    pre_sus_time: Optional[StrictInt] = Field(default=None, description="time job ran prior to last suspend")
    priority: Optional[StrictInt] = Field(default=None, description="relative priority of the job")
    profile: Optional[List[StrictStr]] = Field(default=None, description="Job profiling requested")
    qos: Optional[StrictStr] = Field(default=None, description="Quality of Service")
    reboot: Optional[StrictBool] = Field(default=None, description="node reboot requested before start")
    required_nodes: Optional[StrictStr] = Field(default=None, description="comma separated list of required nodes")
    requeue: Optional[StrictBool] = Field(default=None, description="enable or disable job requeue option")
    resize_time: Optional[StrictInt] = Field(default=None, description="time of latest size change")
    restart_cnt: Optional[StrictInt] = Field(default=None, description="count of job restarts")
    resv_name: Optional[StrictStr] = Field(default=None, description="reservation name")
    shared: Optional[StrictStr] = Field(default=None, description="type and if job can share nodes with other jobs")
    show_flags: Optional[List[StrictStr]] = Field(default=None, description="details requested")
    sockets_per_board: Optional[StrictInt] = Field(default=None, description="sockets per board required by job")
    sockets_per_node: Optional[StrictInt] = Field(default=None, description="sockets per node required by job")
    start_time: Optional[StrictInt] = Field(default=None, description="time execution begins, actual or expected")
    state_description: Optional[StrictStr] = Field(default=None, description="optional details for state_reason")
    state_reason: Optional[StrictStr] = Field(default=None, description="reason job still pending or failed")
    standard_error: Optional[StrictStr] = Field(default=None, description="pathname of job's stderr file")
    standard_input: Optional[StrictStr] = Field(default=None, description="pathname of job's stdin file")
    standard_output: Optional[StrictStr] = Field(default=None, description="pathname of job's stdout file")
    submit_time: Optional[StrictInt] = Field(default=None, description="time of job submission")
    suspend_time: Optional[StrictInt] = Field(default=None, description="time job last suspended or resumed")
    system_comment: Optional[StrictStr] = Field(default=None, description="slurmctld's arbitrary comment")
    time_limit: Optional[StrictInt] = Field(default=None, description="maximum run time in minutes")
    time_minimum: Optional[StrictInt] = Field(default=None, description="minimum run time in minutes")
    threads_per_core: Optional[StrictInt] = Field(default=None, description="threads per core required by job")
    tres_bind: Optional[StrictStr] = Field(default=None, description="Task to TRES binding directives")
    tres_freq: Optional[StrictStr] = Field(default=None, description="TRES frequency directives")
    tres_per_job: Optional[StrictStr] = Field(default=None, description="semicolon delimited list of TRES=# values")
    tres_per_node: Optional[StrictStr] = Field(default=None, description="semicolon delimited list of TRES=# values")
    tres_per_socket: Optional[StrictStr] = Field(default=None, description="semicolon delimited list of TRES=# values")
    tres_per_task: Optional[StrictStr] = Field(default=None, description="semicolon delimited list of TRES=# values")
    tres_req_str: Optional[StrictStr] = Field(default=None, description="tres reqeusted in the job")
    tres_alloc_str: Optional[StrictStr] = Field(default=None, description="tres used in the job")
    user_id: Optional[StrictInt] = Field(default=None, description="user id the job runs as")
    user_name: Optional[StrictStr] = Field(default=None, description="user the job runs as")
    wckey: Optional[StrictStr] = Field(default=None, description="wckey for job")
    current_working_directory: Optional[StrictStr] = Field(default=None, description="pathname of working directory")
    __properties: ClassVar[List[str]] = ["account", "accrue_time", "admin_comment", "array_job_id", "array_task_id", "array_max_tasks", "array_task_string", "association_id", "batch_features", "batch_flag", "batch_host", "flags", "burst_buffer", "burst_buffer_state", "cluster", "cluster_features", "command", "comment", "container", "contiguous", "core_spec", "thread_spec", "cores_per_socket", "billable_tres", "cpus_per_task", "cpu_frequency_minimum", "cpu_frequency_maximum", "cpu_frequency_governor", "cpus_per_tres", "deadline", "delay_boot", "dependency", "derived_exit_code", "eligible_time", "end_time", "excluded_nodes", "exit_code", "features", "federation_origin", "federation_siblings_active", "federation_siblings_viable", "gres_detail", "group_id", "job_id", "job_resources", "job_state", "last_sched_evaluation", "licenses", "max_cpus", "max_nodes", "mcs_label", "memory_per_tres", "name", "nodes", "nice", "tasks_per_core", "tasks_per_socket", "tasks_per_board", "cpus", "node_count", "tasks", "het_job_id", "het_job_id_set", "het_job_offset", "partition", "memory_per_node", "memory_per_cpu", "minimum_cpus_per_node", "minimum_tmp_disk_per_node", "preempt_time", "pre_sus_time", "priority", "profile", "qos", "reboot", "required_nodes", "requeue", "resize_time", "restart_cnt", "resv_name", "shared", "show_flags", "sockets_per_board", "sockets_per_node", "start_time", "state_description", "state_reason", "standard_error", "standard_input", "standard_output", "submit_time", "suspend_time", "system_comment", "time_limit", "time_minimum", "threads_per_core", "tres_bind", "tres_freq", "tres_per_job", "tres_per_node", "tres_per_socket", "tres_per_task", "tres_req_str", "tres_alloc_str", "user_id", "user_name", "wckey", "current_working_directory"]

    model_config = {
        "populate_by_name": True,
        "validate_assignment": True,
        "protected_namespaces": (),
    }


    def to_str(self) -> str:
        """Returns the string representation of the model using alias"""
        return pprint.pformat(self.model_dump(by_alias=True))

    def to_json(self) -> str:
        """Returns the JSON representation of the model using alias"""
        # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
        return json.dumps(self.to_dict())

    @classmethod
    def from_json(cls, json_str: str) -> Self:
        """Create an instance of V0038JobResponseProperties from a JSON string"""
        return cls.from_dict(json.loads(json_str))

    def to_dict(self) -> Dict[str, Any]:
        """Return the dictionary representation of the model using alias.

        This has the following differences from calling pydantic's
        `self.model_dump(by_alias=True)`:

        * `None` is only added to the output dict for nullable fields that
          were set at model initialization. Other fields with value `None`
          are ignored.
        """
        _dict = self.model_dump(
            by_alias=True,
            exclude={
            },
            exclude_none=True,
        )
        # override the default output from pydantic by calling `to_dict()` of job_resources
        if self.job_resources:
            _dict['job_resources'] = self.job_resources.to_dict()
        return _dict

    @classmethod
    def from_dict(cls, obj: Dict) -> Self:
        """Create an instance of V0038JobResponseProperties from a dict"""
        if obj is None:
            return None

        if not isinstance(obj, dict):
            return cls.model_validate(obj)

        _obj = cls.model_validate({
            "account": obj.get("account"),
            "accrue_time": obj.get("accrue_time"),
            "admin_comment": obj.get("admin_comment"),
            "array_job_id": obj.get("array_job_id"),
            "array_task_id": obj.get("array_task_id"),
            "array_max_tasks": obj.get("array_max_tasks"),
            "array_task_string": obj.get("array_task_string"),
            "association_id": obj.get("association_id"),
            "batch_features": obj.get("batch_features"),
            "batch_flag": obj.get("batch_flag"),
            "batch_host": obj.get("batch_host"),
            "flags": obj.get("flags"),
            "burst_buffer": obj.get("burst_buffer"),
            "burst_buffer_state": obj.get("burst_buffer_state"),
            "cluster": obj.get("cluster"),
            "cluster_features": obj.get("cluster_features"),
            "command": obj.get("command"),
            "comment": obj.get("comment"),
            "container": obj.get("container"),
            "contiguous": obj.get("contiguous"),
            "core_spec": obj.get("core_spec"),
            "thread_spec": obj.get("thread_spec"),
            "cores_per_socket": obj.get("cores_per_socket"),
            "billable_tres": obj.get("billable_tres"),
            "cpus_per_task": obj.get("cpus_per_task"),
            "cpu_frequency_minimum": obj.get("cpu_frequency_minimum"),
            "cpu_frequency_maximum": obj.get("cpu_frequency_maximum"),
            "cpu_frequency_governor": obj.get("cpu_frequency_governor"),
            "cpus_per_tres": obj.get("cpus_per_tres"),
            "deadline": obj.get("deadline"),
            "delay_boot": obj.get("delay_boot"),
            "dependency": obj.get("dependency"),
            "derived_exit_code": obj.get("derived_exit_code"),
            "eligible_time": obj.get("eligible_time"),
            "end_time": obj.get("end_time"),
            "excluded_nodes": obj.get("excluded_nodes"),
            "exit_code": obj.get("exit_code"),
            "features": obj.get("features"),
            "federation_origin": obj.get("federation_origin"),
            "federation_siblings_active": obj.get("federation_siblings_active"),
            "federation_siblings_viable": obj.get("federation_siblings_viable"),
            "gres_detail": obj.get("gres_detail"),
            "group_id": obj.get("group_id"),
            "job_id": obj.get("job_id"),
            "job_resources": V0038JobResources.from_dict(obj.get("job_resources")) if obj.get("job_resources") is not None else None,
            "job_state": obj.get("job_state"),
            "last_sched_evaluation": obj.get("last_sched_evaluation"),
            "licenses": obj.get("licenses"),
            "max_cpus": obj.get("max_cpus"),
            "max_nodes": obj.get("max_nodes"),
            "mcs_label": obj.get("mcs_label"),
            "memory_per_tres": obj.get("memory_per_tres"),
            "name": obj.get("name"),
            "nodes": obj.get("nodes"),
            "nice": obj.get("nice"),
            "tasks_per_core": obj.get("tasks_per_core"),
            "tasks_per_socket": obj.get("tasks_per_socket"),
            "tasks_per_board": obj.get("tasks_per_board"),
            "cpus": obj.get("cpus"),
            "node_count": obj.get("node_count"),
            "tasks": obj.get("tasks"),
            "het_job_id": obj.get("het_job_id"),
            "het_job_id_set": obj.get("het_job_id_set"),
            "het_job_offset": obj.get("het_job_offset"),
            "partition": obj.get("partition"),
            "memory_per_node": obj.get("memory_per_node"),
            "memory_per_cpu": obj.get("memory_per_cpu"),
            "minimum_cpus_per_node": obj.get("minimum_cpus_per_node"),
            "minimum_tmp_disk_per_node": obj.get("minimum_tmp_disk_per_node"),
            "preempt_time": obj.get("preempt_time"),
            "pre_sus_time": obj.get("pre_sus_time"),
            "priority": obj.get("priority"),
            "profile": obj.get("profile"),
            "qos": obj.get("qos"),
            "reboot": obj.get("reboot"),
            "required_nodes": obj.get("required_nodes"),
            "requeue": obj.get("requeue"),
            "resize_time": obj.get("resize_time"),
            "restart_cnt": obj.get("restart_cnt"),
            "resv_name": obj.get("resv_name"),
            "shared": obj.get("shared"),
            "show_flags": obj.get("show_flags"),
            "sockets_per_board": obj.get("sockets_per_board"),
            "sockets_per_node": obj.get("sockets_per_node"),
            "start_time": obj.get("start_time"),
            "state_description": obj.get("state_description"),
            "state_reason": obj.get("state_reason"),
            "standard_error": obj.get("standard_error"),
            "standard_input": obj.get("standard_input"),
            "standard_output": obj.get("standard_output"),
            "submit_time": obj.get("submit_time"),
            "suspend_time": obj.get("suspend_time"),
            "system_comment": obj.get("system_comment"),
            "time_limit": obj.get("time_limit"),
            "time_minimum": obj.get("time_minimum"),
            "threads_per_core": obj.get("threads_per_core"),
            "tres_bind": obj.get("tres_bind"),
            "tres_freq": obj.get("tres_freq"),
            "tres_per_job": obj.get("tres_per_job"),
            "tres_per_node": obj.get("tres_per_node"),
            "tres_per_socket": obj.get("tres_per_socket"),
            "tres_per_task": obj.get("tres_per_task"),
            "tres_req_str": obj.get("tres_req_str"),
            "tres_alloc_str": obj.get("tres_alloc_str"),
            "user_id": obj.get("user_id"),
            "user_name": obj.get("user_name"),
            "wckey": obj.get("wckey"),
            "current_working_directory": obj.get("current_working_directory")
        })
        return _obj


