Documentation
¶
Overview ¶
Copyright (C) NHR@FAU, University Erlangen-Nuremberg. All rights reserved. This file is part of cc-lib. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file.
Copyright (C) NHR@FAU, University Erlangen-Nuremberg. All rights reserved. This file is part of cc-lib. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file.
Copyright (C) NHR@FAU, University Erlangen-Nuremberg. All rights reserved. This file is part of cc-lib. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file.
Copyright (C) NHR@FAU, University Erlangen-Nuremberg. All rights reserved. This file is part of cc-lib. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file.
Copyright (C) NHR@FAU, University Erlangen-Nuremberg. All rights reserved. This file is part of cc-lib. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file.
Copyright (C) NHR@FAU, University Erlangen-Nuremberg. All rights reserved. This file is part of cc-lib. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file.
Copyright (C) NHR@FAU, University Erlangen-Nuremberg. All rights reserved. This file is part of cc-lib. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file.
Index ¶
- Constants
- func ConvertFloatToFloat64(s []Float) []float64
- func GetRoleString(roleInt Role) string
- func GetValidRoles(user *User) ([]string, error)
- func GetValidRolesMap(user *User) (map[string]Role, error)
- func IsValidRole(role string) bool
- func Validate(k Kind, r io.Reader) error
- type Accelerator
- type AuthSource
- type AuthType
- type Cluster
- type ClusterSupport
- type Float
- type FloatArray
- type GlobalMetricListItem
- type Job
- type JobData
- type JobLink
- type JobLinkResultList
- type JobMetric
- type JobState
- type JobStatistics
- type Kind
- type Metric
- type MetricConfig
- type MetricScope
- type MetricStatistics
- type MetricValue
- type MonitoringState
- type Node
- type NodeState
- type Resource
- type Role
- type ScopedJobStats
- type ScopedStats
- type Series
- type StatsSeries
- type SubCluster
- type SubClusterConfig
- type Tag
- type Topology
- func (topo *Topology) GetAcceleratorID(id int) (string, error)
- func (topo *Topology) GetAcceleratorIDs() []string
- func (topo *Topology) GetAcceleratorIDsAsInt() ([]int, error)
- func (topo *Topology) GetCoresFromHWThreads(hwthreads []int) (cores []int, exclusive bool)
- func (topo *Topology) GetMemoryDomainsFromHWThreads(hwthreads []int) (memDoms []int, exclusive bool)
- func (topo *Topology) GetSocketsFromCores(cores []int) (sockets []int, exclusive bool)
- func (topo *Topology) GetSocketsFromHWThreads(hwthreads []int) (sockets []int, exclusive bool)
- type Unit
- type User
- func (u *User) GetAuthLevel() Role
- func (u *User) HasAllRoles(queryroles []Role) bool
- func (u *User) HasAnyRole(queryroles []Role) bool
- func (u *User) HasNotRoles(queryroles []Role) bool
- func (u *User) HasProject(project string) bool
- func (u *User) HasRole(role Role) bool
- func (u *User) HasValidRole(role string) (hasRole bool, isValid bool)
Constants ¶
const ( MonitoringStatusDisabled int32 = 0 MonitoringStatusRunningOrArchiving int32 = 1 MonitoringStatusArchivingFailed int32 = 2 MonitoringStatusArchivingSuccessful int32 = 3 )
Variables ¶
This section is empty.
Functions ¶
func ConvertFloatToFloat64 ¶
func GetRoleString ¶
func GetValidRoles ¶
Called by API endpoint '/roles/' from frontend: Only required for admin config -> Check Admin Role
func GetValidRolesMap ¶
Called by routerConfig web.page setup in backend: Only requires known user
func IsValidRole ¶
Types ¶
type Accelerator ¶
type AuthSource ¶
type AuthSource int
const ( AuthViaLocalPassword AuthSource = iota AuthViaLDAP AuthViaToken AuthViaOIDC AuthViaAll )
type Cluster ¶
type Cluster struct {
Name string `json:"name"`
MetricConfig []*MetricConfig `json:"metricConfig"`
SubClusters []*SubCluster `json:"subClusters"`
}
type ClusterSupport ¶
type Float ¶
type Float float64
A custom float type is used so that (Un)MarshalJSON and (Un)MarshalGQL can be overloaded and NaN/null can be used. The default behaviour of putting every nullable value behind a pointer has a bigger overhead.
func ConvertToFloat ¶ added in v0.8.0
func GetFloat64ToFloat ¶
func (Float) MarshalGQL ¶
MarshalGQL implements the graphql.Marshaler interface. NaN will be serialized to `null`.
func (Float) MarshalJSON ¶
NaN will be serialized to `null`.
func (*Float) UnmarshalGQL ¶
UnmarshalGQL implements the graphql.Unmarshaler interface.
func (*Float) UnmarshalJSON ¶
`null` will be unserialized to NaN.
type FloatArray ¶ added in v0.8.0
type FloatArray []Float
Same as `[]Float`, but can be marshaled to JSON with less allocations.
type GlobalMetricListItem ¶
type GlobalMetricListItem struct {
Name string `json:"name"`
Unit Unit `json:"unit"`
Scope MetricScope `json:"scope"`
Footprint string `json:"footprint,omitempty"`
Availability []ClusterSupport `json:"availability"`
}
type Job ¶
type Job struct {
Cluster string `json:"cluster" db:"hpc_cluster" example:"fritz"`
SubCluster string `json:"subCluster" db:"subcluster" example:"main"`
Partition string `json:"partition,omitempty" db:"cluster_partition" example:"main"`
Project string `json:"project" db:"project" example:"abcd200"`
User string `json:"user" db:"hpc_user" example:"abcd100h"`
State JobState `` /* 172-byte string literal not displayed */
Tags []*Tag `json:"tags,omitempty"`
RawEnergyFootprint []byte `json:"-" db:"energy_footprint"`
RawFootprint []byte `json:"-" db:"footprint"`
RawMetaData []byte `json:"-" db:"meta_data"`
RawResources []byte `json:"-" db:"resources"`
Resources []*Resource `json:"resources"`
EnergyFootprint map[string]float64 `json:"energyFootprint"`
Footprint map[string]float64 `json:"footprint"`
MetaData map[string]string `json:"metaData"`
ConcurrentJobs JobLinkResultList `json:"concurrentJobs"`
Energy float64 `json:"energy" db:"energy"`
ArrayJobId int64 `json:"arrayJobId,omitempty" db:"array_job_id" example:"123000"`
Walltime int64 `json:"walltime,omitempty" db:"walltime" example:"86400" minimum:"1"`
RequestedMemory int64 `json:"requestedMemory,omitempty" db:"requested_memory" example:"128000" minimum:"1"` // in MB
JobID int64 `json:"jobId" db:"job_id" example:"123000"`
Duration int32 `json:"duration" db:"duration" example:"43200" minimum:"1"`
SMT int32 `json:"smt,omitempty" db:"smt" example:"4"`
MonitoringStatus int32 `json:"monitoringStatus,omitempty" db:"monitoring_status" example:"1" minimum:"0" maximum:"3"`
NumAcc int32 `json:"numAcc,omitempty" db:"num_acc" example:"2" minimum:"1"`
NumHWThreads int32 `json:"numHwthreads,omitempty" db:"num_hwthreads" example:"20" minimum:"1"`
NumNodes int32 `json:"numNodes" db:"num_nodes" example:"2" minimum:"1"`
Statistics map[string]JobStatistics `json:"statistics"`
ID *int64 `json:"id,omitempty" db:"id"`
SubmitTime int64 `json:"submitTime,omitempty" db:"submit_time" example:"1649723812"`
StartTime int64 `json:"startTime" db:"start_time" example:"1649723812"`
}
type JobData ¶
type JobData map[string]map[MetricScope]*JobMetric
func (*JobData) AddNodeScope ¶
func (*JobData) RoundMetricStats ¶ added in v0.3.0
func (jd *JobData) RoundMetricStats()
type JobLinkResultList ¶
type JobMetric ¶
type JobMetric struct {
StatisticsSeries *StatsSeries `json:"statisticsSeries,omitempty"`
Unit Unit `json:"unit"`
Series []Series `json:"series"`
Timestep int `json:"timestep"`
}
func (*JobMetric) AddPercentiles ¶
func (*JobMetric) AddStatisticsSeries ¶
func (jm *JobMetric) AddStatisticsSeries()
type JobState ¶
type JobState string
const ( JobStateBootFail JobState = "boot_fail" JobStateCancelled JobState = "cancelled" JobStateCompleted JobState = "completed" JobStateDeadline JobState = "deadline" JobStateFailed JobState = "failed" JobStateNodeFail JobState = "node_fail" JobStateOutOfMemory JobState = "out_of_memory" JobStatePending JobState = "pending" JobStatePreempted JobState = "preempted" JobStateRunning JobState = "running" JobStateSuspended JobState = "suspended" JobStateTimeout JobState = "timeout" )
func (JobState) MarshalGQL ¶
func (*JobState) UnmarshalGQL ¶
type JobStatistics ¶
type JobStatistics struct {
Unit Unit `json:"unit"`
Avg float64 `json:"avg" example:"2500" minimum:"0"` // Job metric average
Min float64 `json:"min" example:"2000" minimum:"0"` // Job metric minimum
Max float64 `json:"max" example:"3000" minimum:"0"` // Job metric maximum
}
JobStatistics model @Description Specification for job metric statistics.
type MetricConfig ¶
type MetricConfig struct {
Metric
Energy string `json:"energy"`
Scope MetricScope `json:"scope"`
Aggregation string `json:"aggregation"`
Footprint string `json:"footprint,omitempty"`
SubClusters []*SubClusterConfig `json:"subClusters,omitempty"`
Timestep int `json:"timestep"`
LowerIsBetter bool `json:"lowerIsBetter"`
}
type MetricScope ¶
type MetricScope string
const ( MetricScopeInvalid MetricScope = "invalid_scope" MetricScopeNode MetricScope = "node" MetricScopeSocket MetricScope = "socket" MetricScopeMemoryDomain MetricScope = "memoryDomain" MetricScopeCore MetricScope = "core" MetricScopeHWThread MetricScope = "hwthread" MetricScopeAccelerator MetricScope = "accelerator" )
func (*MetricScope) LT ¶
func (e *MetricScope) LT(other MetricScope) bool
func (*MetricScope) LTE ¶
func (e *MetricScope) LTE(other MetricScope) bool
func (MetricScope) MarshalGQL ¶
func (e MetricScope) MarshalGQL(w io.Writer)
func (*MetricScope) Max ¶
func (e *MetricScope) Max(other MetricScope) MetricScope
func (*MetricScope) UnmarshalGQL ¶
func (e *MetricScope) UnmarshalGQL(v any) error
func (MetricScope) Valid ¶
func (e MetricScope) Valid() bool
type MetricStatistics ¶
type MetricValue ¶
type MonitoringState ¶ added in v0.3.0
type MonitoringState string
const ( MonitoringStateFull MonitoringState = "full" MonitoringStatePartial MonitoringState = "partial" MonitoringStateFailed MonitoringState = "failed" )
type Node ¶ added in v0.3.0
type Node struct {
ID int64 `json:"id" db:"id"`
TimeStamp int64 `json:"timeStamp" db:"time_stamp" example:"1649723812"`
Hostname string `json:"hostname" db:"hostname" example:"fritz"`
Cluster string `json:"cluster" db:"cluster" example:"fritz"`
SubCluster string `json:"subCluster" db:"subcluster" example:"main"`
NodeState NodeState `json:"nodeState" db:"node_state" example:"completed" enums:"completed,failed,cancelled,stopped,timeout,out_of_memory"`
HealthState MonitoringState `json:"healthState" db:"health_state" example:"completed" enums:"completed,failed,cancelled,stopped,timeout,out_of_memory"`
CpusAllocated int `json:"cpusAllocated" db:"cpus_allocated"`
CpusTotal int `json:"cpusTotal" db:"cpus_total"`
MemoryAllocated int `json:"memoryAllocated" db:"memory_allocated"`
MemoryTotal int `json:"memoryTotal" db:"memory_total"`
GpusAllocated int `json:"gpusAllocated" db:"gpus_allocated"`
GpusTotal int `json:"gpusTotal" db:"gpus_total"`
JobsRunning int64 `json:"jobsRunning" db:"jobs_running" example:"12"`
RawMetaData []byte `json:"-" db:"meta_data"`
MetaData map[string]string `json:"metaData"`
}
type Resource ¶
type Resource struct {
Hostname string `json:"hostname"`
Configuration string `json:"configuration,omitempty"`
HWThreads []int `json:"hwthreads,omitempty"`
Accelerators []string `json:"accelerators,omitempty"`
}
Resource model @Description A resource used by a job
type ScopedJobStats ¶ added in v0.3.0
type ScopedJobStats map[string]map[MetricScope][]*ScopedStats
type ScopedStats ¶ added in v0.3.0
type ScopedStats struct {
Hostname string `json:"hostname"`
Id *string `json:"id,omitempty"`
Data *MetricStatistics `json:"data"`
}
type Series ¶
type Series struct {
Id *string `json:"id,omitempty"`
Hostname string `json:"hostname"`
Data []Float `json:"data"`
Statistics MetricStatistics `json:"statistics"`
}
func (*Series) MarshalJSON ¶
Only used via REST-API, not via GraphQL. This uses a lot less allocations per series, but it turns out that the performance increase from using this is not that big.
type StatsSeries ¶
type SubCluster ¶
type SubCluster struct {
Name string `json:"name"`
Nodes string `json:"nodes"`
ProcessorType string `json:"processorType"`
Topology Topology `json:"topology"`
FlopRateScalar MetricValue `json:"flopRateScalar"`
FlopRateSimd MetricValue `json:"flopRateSimd"`
MemoryBandwidth MetricValue `json:"memoryBandwidth"`
MetricConfig []MetricConfig `json:"metricConfig,omitempty"`
Footprint []string `json:"footprint,omitempty"`
EnergyFootprint []string `json:"energyFootprint,omitempty"`
SocketsPerNode int `json:"socketsPerNode"`
CoresPerSocket int `json:"coresPerSocket"`
ThreadsPerCore int `json:"threadsPerCore"`
}
type SubClusterConfig ¶
type Tag ¶
type Tag struct {
Type string `json:"type" db:"tag_type" example:"Debug"`
Name string `json:"name" db:"tag_name" example:"Testjob"`
Scope string `json:"scope" db:"tag_scope" example:"global"`
ID int64 `json:"id" db:"id"`
}
Tag model @Description Defines a tag using name and type.
type Topology ¶
type Topology struct {
Node []int `json:"node"`
Socket [][]int `json:"socket"`
MemoryDomain [][]int `json:"memoryDomain"`
Die [][]*int `json:"die,omitempty"`
Core [][]int `json:"core"`
Accelerators []*Accelerator `json:"accelerators,omitempty"`
}
func (*Topology) GetAcceleratorID ¶
Temporary fix to convert back from int id to string id for accelerators
func (*Topology) GetAcceleratorIDs ¶
Return list of hardware (string) accelerator IDs
func (*Topology) GetAcceleratorIDsAsInt ¶
Outdated? Or: Return indices of accelerators in parent array?
func (*Topology) GetCoresFromHWThreads ¶
Return a list of core IDs given a list of hwthread IDs. Even if just one hwthread is in that core, add it to the list. If no hwthreads other than those in the argument list are assigned to one of the cores in the first return value, return true as the second value. TODO: Optimize this, there must be a more efficient way/algorithm.
func (*Topology) GetMemoryDomainsFromHWThreads ¶
func (topo *Topology) GetMemoryDomainsFromHWThreads( hwthreads []int, ) (memDoms []int, exclusive bool)
Return a list of memory domain IDs given a list of hwthread IDs. Even if just one hwthread is in that memory domain, add it to the list. If no hwthreads other than those in the argument list are assigned to one of the memory domains in the first return value, return true as the second value. TODO: Optimize this, there must be a more efficient way/algorithm.
func (*Topology) GetSocketsFromCores ¶ added in v0.3.0
Return a list of socket IDs given a list of core IDs. Even if just one core is in that socket, add it to the list. If no cores other than those in the argument list are assigned to one of the sockets in the first return value, return true as the second value. TODO: Optimize this, there must be a more efficient way/algorithm.
func (*Topology) GetSocketsFromHWThreads ¶
Return a list of socket IDs given a list of hwthread IDs. Even if just one hwthread is in that socket, add it to the list. If no hwthreads other than those in the argument list are assigned to one of the sockets in the first return value, return true as the second value. TODO: Optimize this, there must be a more efficient way/algorithm.
type User ¶
type User struct {
Username string `json:"username"`
Password string `json:"-"`
Name string `json:"name"`
Email string `json:"email"`
Roles []string `json:"roles"`
Projects []string `json:"projects"`
AuthType AuthType `json:"authType"`
AuthSource AuthSource `json:"authSource"`
}
func (*User) HasAllRoles ¶
Check if User has ALL of the listed roles
func (*User) HasAnyRole ¶
Check if User has ANY of the listed roles
func (*User) HasNotRoles ¶
Check if User has NONE of the listed roles