Skip to content

Commit

Permalink
Fix rebasing bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
deadlycoconuts committed Mar 22, 2022
1 parent a3198d9 commit 1215fe3
Show file tree
Hide file tree
Showing 10 changed files with 89 additions and 267 deletions.
228 changes: 54 additions & 174 deletions api/api/openapi.bundle.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1951,6 +1951,11 @@ components:
max_replica: 6
memory_request: memory_request
cpu_request: cpu_request
env:
- name: name
value: value
- name: name
value: value
timeout: timeout
updated_at: 2000-01-23T04:56:07.000+00:00
standard_config:
Expand Down Expand Up @@ -2212,6 +2217,11 @@ components:
max_replica: 6
memory_request: memory_request
cpu_request: cpu_request
env:
- name: name
value: value
- name: name
value: value
timeout: timeout
updated_at: 2000-01-23T04:56:07.000+00:00
standard_config:
Expand Down Expand Up @@ -2347,6 +2357,11 @@ components:
max_replica: 6
memory_request: memory_request
cpu_request: cpu_request
env:
- name: name
value: value
- name: name
value: value
timeout: timeout
nullable: true
properties:
Expand All @@ -2359,6 +2374,10 @@ components:
timeout:
pattern: ^[0-9]+(ms|s|m|h)$
type: string
env:
items:
$ref: '#/components/schemas/EnvVar'
type: array
required:
- ensembler_id
- project_id
Expand Down Expand Up @@ -2502,6 +2521,11 @@ components:
max_replica: 6
memory_request: memory_request
cpu_request: cpu_request
env:
- name: name
value: value
- name: name
value: value
timeout: timeout
updated_at: 2000-01-23T04:56:07.000+00:00
standard_config:
Expand Down Expand Up @@ -2552,34 +2576,12 @@ components:
pattern: ^[a-z0-9-]*$
type: string
config:
$ref: '#/components/schemas/RouterConfig_config'
$ref: '#/components/schemas/RouterVersionConfig'
required:
- config
- environment_name
- name
type: object
RouterId:
$ref: '#/components/schemas/IdObject'
RouterIdAndVersion:
example:
router_id: 0
version: 6
properties:
router_id:
format: int32
type: integer
version:
format: int32
type: integer
type: object
RouterIdObject:
example:
router_id: 0
properties:
router_id:
format: int32
type: integer
type: object
RouterVersionConfig:
example:
enricher:
Expand Down Expand Up @@ -2656,6 +2658,11 @@ components:
max_replica: 6
memory_request: memory_request
cpu_request: cpu_request
env:
- name: name
value: value
- name: name
value: value
timeout: timeout
updated_at: 2000-01-23T04:56:07.000+00:00
standard_config:
Expand Down Expand Up @@ -2717,7 +2724,7 @@ components:
pattern: ^[0-9]+(ms|s|m|h)$
type: string
log_config:
$ref: '#/components/schemas/RouterConfig_config_log_config'
$ref: '#/components/schemas/RouterVersionConfig_log_config'
enricher:
$ref: '#/components/schemas/Enricher'
ensembler:
Expand All @@ -2729,6 +2736,28 @@ components:
- routes
- timeout
type: object
RouterId:
$ref: '#/components/schemas/IdObject'
RouterIdAndVersion:
example:
router_id: 0
version: 6
properties:
router_id:
format: int32
type: integer
version:
format: int32
type: integer
type: object
RouterIdObject:
example:
router_id: 0
properties:
router_id:
format: int32
type: integer
type: object
RouterEvents:
example:
events:
Expand Down Expand Up @@ -3230,7 +3259,7 @@ components:
- route
- treatment
type: object
RouterConfig_config_log_config:
RouterVersionConfig_log_config:
example:
bigquery_config:
batch_load: true
Expand All @@ -3248,155 +3277,6 @@ components:
kafka_config:
$ref: '#/components/schemas/KafkaConfig'
type: object
RouterConfig_config:
example:
enricher:
service_account: secret-name-for-google-service-account
image: image
endpoint: endpoint
updated_at: 2000-01-23T04:56:07.000+00:00
port: 5
created_at: 2000-01-23T04:56:07.000+00:00
resource_request:
min_replica: 0
max_replica: 6
memory_request: memory_request
cpu_request: cpu_request
id: 1
env:
- name: name
value: value
- name: name
value: value
timeout: timeout
routes:
- endpoint: endpoint
annotations: '{}'
id: id
type: type
timeout: timeout
- endpoint: endpoint
annotations: '{}'
id: id
type: type
timeout: timeout
default_route_id: default_route_id
rules:
- routes:
- routes
- routes
conditions:
- field: field
values:
- values
- values
operator: in
- field: field
values:
- values
- values
operator: in
- routes:
- routes
- routes
conditions:
- field: field
values:
- values
- values
operator: in
- field: field
values:
- values
- values
operator: in
resource_request:
min_replica: 0
max_replica: 6
memory_request: memory_request
cpu_request: cpu_request
ensembler:
pyfunc_config:
project_id: 7
ensembler_id: 9
resource_request:
min_replica: 0
max_replica: 6
memory_request: memory_request
cpu_request: cpu_request
timeout: timeout
updated_at: 2000-01-23T04:56:07.000+00:00
standard_config:
experiment_mappings:
- treatment: treatment-1
route: route-1
experiment: experiment-1
- treatment: treatment-1
route: route-1
experiment: experiment-1
created_at: 2000-01-23T04:56:07.000+00:00
id: 5
type: standard
docker_config:
service_account: secret-name-for-google-service-account
image: image
endpoint: endpoint
port: 2
resource_request:
min_replica: 0
max_replica: 6
memory_request: memory_request
cpu_request: cpu_request
env:
- name: name
value: value
- name: name
value: value
timeout: timeout
log_config:
bigquery_config:
batch_load: true
table: table
service_account_secret: service_account_secret
kafka_config:
brokers: brokers
topic: topic
serialization_format: json
timeout: timeout
experiment_engine:
type: nop
config: '{}'
properties:
routes:
items:
$ref: '#/components/schemas/Route'
type: array
rules:
items:
$ref: '#/components/schemas/TrafficRule'
type: array
default_route_id:
type: string
experiment_engine:
$ref: '#/components/schemas/ExperimentConfig'
resource_request:
$ref: '#/components/schemas/ResourceRequest'
timeout:
pattern: ^[0-9]+(ms|s|m|h)$
type: string
log_config:
$ref: '#/components/schemas/RouterConfig_config_log_config'
enricher:
$ref: '#/components/schemas/Enricher'
ensembler:
$ref: '#/components/schemas/RouterEnsemblerConfig'
required:
- default_route_id
- experiment_engine
- log_config
- routes
- timeout
type: object
StandardExperimentEngine_allOf_standard_experiment_manager_config:
nullable: true
properties:
Expand Down
42 changes: 5 additions & 37 deletions api/api/specs/routers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -599,43 +599,7 @@ components:
type: "string"
pattern: '^[a-z0-9-]*$'
config:
type: "object"
required:
- routes
- default_route_id
- experiment_engine
- timeout
- log_config
properties:
routes:
type: "array"
items:
$ref: "#/components/schemas/Route"
rules:
type: "array"
items:
$ref: "#/components/schemas/TrafficRule"
default_route_id:
type: "string"
experiment_engine:
$ref: "experiment-engines.yaml#/components/schemas/ExperimentConfig"
resource_request:
$ref: "#/components/schemas/ResourceRequest"
timeout:
<<: *timeout
log_config:
type: "object"
properties:
result_logger_type:
$ref: "#/components/schemas/ResultLoggerType"
bigquery_config:
$ref: "#/components/schemas/BigQueryConfig"
kafka_config:
$ref: "#/components/schemas/KafkaConfig"
enricher:
$ref: "#/components/schemas/Enricher"
ensembler:
$ref: "#/components/schemas/RouterEnsemblerConfig"
$ref: "#/components/schemas/RouterVersionConfig"

RouterVersionConfig:
type: "object"
Expand Down Expand Up @@ -887,6 +851,10 @@ components:
$ref: "#/components/schemas/ResourceRequest"
timeout:
<<: *timeout
env:
type: "array"
items:
$ref: "common.yaml#/components/schemas/EnvVar"

ResourceRequest:
type: "object"
Expand Down
19 changes: 8 additions & 11 deletions api/turing/api/router_versions_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,24 +48,21 @@ func (c RouterVersionsController) CreateRouterVersion(r *http.Request, vars Requ
return errResp
}

requestConfig := body.(*request.RouterConfig)

// This is used temporarily in order to reuse the BuildRouterVersion method
dummyRouterRequest := request.CreateOrUpdateRouterRequest{
Environment: "",
Name: "",
Config: requestConfig,
}
request := body.(*request.RouterConfig)

// Create new version
var routerVersion *models.RouterVersion
rVersion, err := dummyRouterRequest.BuildRouterVersion(
if request == nil {
return InternalServerError("unable to create router version", "router config is empty")
}

routerVersion, err := request.BuildRouterVersion(
router, c.RouterDefaults, c.AppContext.CryptoService, c.AppContext.ExperimentsService, c.EnsemblersService)

if err == nil {
// Save router version, re-assign the value of err
rVersion.Status = models.RouterVersionStatusUndeployed
routerVersion, err = c.RouterVersionsService.Save(rVersion)
routerVersion.Status = models.RouterVersionStatusUndeployed
routerVersion, err = c.RouterVersionsService.Save(routerVersion)
}

if err != nil {
Expand Down
Loading

0 comments on commit 1215fe3

Please sign in to comment.