ADCT Python
Python client API implementation for publishing ADCT data
Loading...
Searching...
No Matches
Public Member Functions | List of all members
adctk.builder.Host Class Reference

Section for host OS, with optional hardware details. More...

Inheritance diagram for adctk.builder.Host:
Inheritance graph
[legend]
Collaboration diagram for adctk.builder.Host:
Collaboration graph
[legend]

Public Member Functions

 __init__ (self, bool osinfo, bool ramsize, bool env, bool cpu, bool gpu, bool numa)
 
- Public Member Functions inherited from adctk.builder.Builder
adc_types.Field get_value (self, str path_full)
 get the existing named nested field in the builder.
 
 get_value_string (self, str path)
 get the existing named nested scalar string value.
 
 get_value_int64 (self, str path)
 get the existing named nested scalar int64-equivalent value.
 
 get_value_uint64 (self, str path)
 get the existing named nested scalar uint64-equivalent value.
 
 __json__ (self)
 
 add_header_section (self, str application_name)
 Create or replace the 'header' section using application_name.
 
 add_host_section (self, osinfo=False, ramsize=False, env=False, cpu=False, gpu=False, numa=False, all_hs=False)
 Add the 'host' section, with optional subgroups of properties.
 
 add_app_data_section (self, 'Builder' app_data)
 Create the "app_data" section with data defined by the application writer.
 
 add_model_data_section (self, 'Builder' model_data)
 populate application run-time physics (re)configuration or result to "model_data" section.
 
 add_code_section (self, str tag, 'Builder' version, 'Builder|None' code_details=None)
 Add the 'code' section, with user-specified version subsection and optional code_details section describing things which do not normally vary with invocation.
 
 add_code_configuration_section (self, 'Builder' build_details)
 
 add_exit_data_section (self, 'int|str' return_code, str status, 'Builder|None' status_details=None)
 populate "exit_data" section with return code and status string & user provided details.
 
 add_memory_usage_section (self)
 Populate "memory_usage" section with current host /proc/meminfo data in the style of free(1).
 
'Builder|None' get_section (self, str name)
 get the existing named section.
 
'list[str]' get_section_names (self)
 Get the names of sections.
 
 add_mpi_section (self, name, communicator, bool rank=False, bool size=False, bool mpi_name=False, bool hostlist=False, bool rank_host=False, bool ver=False, bool lib_ver=False, bool mpiall=False, bool local=False)
 Unimplemented: python with mpi is not yet supported.
 
 add_gitlab_ci_section (self)
 Add gitlab_ci environment variable dictionary.
 
 add_workflow_section (self, str|None wfid=None, str|None parent=None, list[str]|str|None children=None)
 add data from adc_wfid_ environment variables.
 
 add_workflow_children (self, collections.abc.Iterable[str] child_uuids)
 Add list of child uuids to "adc_workflow" section after add_workflow_section has been called.
 
 add_slurm_section (self, collections.abc.Iterable[str]|None output_vars=None)
 Add slurm output environment variable dictionary elements.
 
 add_section (self, str name, 'Builder|collections.abc.Mapping[str,...]' section)
 Add or replace a user-defined, named section.
 
str serialize (self)
 get json string of the builder.
 
 add (self, str name, any value, value_type=None)
 add named item and its datatype information to the builder.
 
 add_path (self, name, str path)
 Add string file path.
 
 add_json_string (self, str name, str js)
 Add stringified json.
 
 add_yaml_string (self, str name, str yaml)
 Add stringified yaml.
 
 add_xml_string (self, str name, str xml)
 Add stringified xml.
 
 add_number_string (self, str name, decimal.Decimal dec)
 Add stringified number of arbitrary precision.
 
 add_epoch (self, name, int epoch)
 add unix epoch seconds (gettimeofday)
 
 add_mime (self, str name, str mime_type, str encoding, str file_name, str data)
 add a string encoded object (e.g.
 
 add_array_typed_string (self, name, adc_types.ScalarType st, collections.abc.Iterable[str] strings)
 Add string group tagged with scalar type.
 

Additional Inherited Members

- Static Public Member Functions inherited from adctk.builder.Builder
'Builder' BasicBuilder (str app_name)
 DEPRECATED.
 
- Static Public Attributes inherited from adctk.builder.Builder
 API_VERSION = adc_version.AdcVersion()._dict()
 
- Protected Member Functions inherited from adctk.builder.Builder
 _set_attr (self, name, value)
 
 _get_attr (self, name)
 
 _find_path (self, obj, path)
 
dict _flatten (self, depth=0)
 Get a dictionary tree-copy constructed from keys and sections.
 
adc_types.KeyType _kind (self, str name)
 

Detailed Description

Section for host OS, with optional hardware details.

Constructor & Destructor Documentation

◆ __init__()

adctk.builder.Host.__init__ (   self,
bool  osinfo,
bool  ramsize,
bool  env,
bool  cpu,
bool  gpu,
bool  numa 
)

Reimplemented from adctk.builder.Builder.

1179 def __init__(self, osinfo: bool, ramsize: bool, env: bool, cpu: bool, gpu: bool, numa: bool):
1180 super().__init__()
1181 ubuf = platform.uname()
1182 self._set_attr( "name", ubuf.node )
1183 if osinfo:
1184 self._set_attr("os_family", ubuf.system)
1185 self._set_attr("os_version", ubuf.release)
1186 self._set_attr("os_arch", ubuf.machine)
1187 self._set_attr("os_build", ubuf.version)
1188 if env:
1189 vlist = os.getenv("ADC_HOST_SECTION_ENV")
1190 if vlist:
1191 for e in vlist.split(":"):
1192 if e and len(e):
1193 x = os.getenv(e)
1194 if x:
1195 self._set_attr(e, x)
1196 if ramsize:
1197 self._set_attr("mem_total", get_meminfo("MemTotal"))
1198 if cpu:
1199 x = get_lscpu()
1200 self._set_attr("cpu", x)
1201 if gpu:
1202 x = get_gpu_data()
1203 self._set_attr("gpu", x)
1204 if numa:
1205 x = get_numa_hardware()
1206 self._set_attr("numa_hardware", x)
1207

The documentation for this class was generated from the following file: