forked from rai-project/dlframework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dlframework_execution_options.go
131 lines (101 loc) · 3.11 KB
/
dlframework_execution_options.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
// Code generated by go-swagger; DO NOT EDIT.
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
strfmt "github.com/go-openapi/strfmt"
"github.com/go-openapi/errors"
"github.com/go-openapi/swag"
)
// DlframeworkExecutionOptions dlframework execution options
// swagger:model dlframeworkExecutionOptions
type DlframeworkExecutionOptions struct {
// Options that apply to all CPUs.
CPUOptions DlframeworkCPUOptions `json:"cpu_options,omitempty"`
// Map from device type name (e.g., "CPU" or "GPU" ) to maximum
// number of devices of that type to use. If a particular device
// type is not found in the map, the system picks an appropriate
// number.
DeviceCount map[string]int32 `json:"device_count,omitempty"`
// Options that apply to all GPUs.
GpuOptions *DlframeworkGPUOptions `json:"gpu_options,omitempty"`
// Time to wait for operation to complete in milliseconds.
TimeoutInMs string `json:"timeout_in_ms,omitempty"`
// trace id
TraceID *DlframeworkTraceID `json:"trace_id,omitempty"`
// trace level
TraceLevel ExecutionOptionsTraceLevel `json:"trace_level,omitempty"`
}
// Validate validates this dlframework execution options
func (m *DlframeworkExecutionOptions) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateGpuOptions(formats); err != nil {
res = append(res, err)
}
if err := m.validateTraceID(formats); err != nil {
res = append(res, err)
}
if err := m.validateTraceLevel(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *DlframeworkExecutionOptions) validateGpuOptions(formats strfmt.Registry) error {
if swag.IsZero(m.GpuOptions) { // not required
return nil
}
if m.GpuOptions != nil {
if err := m.GpuOptions.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("gpu_options")
}
return err
}
}
return nil
}
func (m *DlframeworkExecutionOptions) validateTraceID(formats strfmt.Registry) error {
if swag.IsZero(m.TraceID) { // not required
return nil
}
if m.TraceID != nil {
if err := m.TraceID.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("trace_id")
}
return err
}
}
return nil
}
func (m *DlframeworkExecutionOptions) validateTraceLevel(formats strfmt.Registry) error {
if swag.IsZero(m.TraceLevel) { // not required
return nil
}
if err := m.TraceLevel.Validate(formats); err != nil {
if ve, ok := err.(*errors.Validation); ok {
return ve.ValidateName("trace_level")
}
return err
}
return nil
}
// MarshalBinary interface implementation
func (m *DlframeworkExecutionOptions) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *DlframeworkExecutionOptions) UnmarshalBinary(b []byte) error {
var res DlframeworkExecutionOptions
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}