-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add env vars support to Pyfunc ensembler #181
Changes from 44 commits
57e74c4
08b02f4
714ef51
6ec6fa1
80e419a
470e139
872561c
6704b57
60df8b6
3814012
7406595
a5d9ed4
30dc347
54ed9c1
375e2c6
cd92d6d
1565b79
ff62970
16fb219
ff808b9
a30e976
54a81f0
807fcb7
c09f578
0d93d2b
3a9a6b9
f53108b
be1788a
cd3d40b
121b1a0
cd1ede4
7660d29
a521723
e75a2ea
a3198d9
1215fe3
0ad9402
5074882
4b1de57
5707207
e1bea16
88299cf
3d98112
ac542b9
3da6679
d846112
e73687e
567ad35
cad27fa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
-- Removes py_func_ref_config from table. | ||
-- Removes pyfunc_config from table. | ||
-- Hence, this migration involves data loss for ensemblers with type that is "pyfunc" | ||
ALTER TABLE ensembler_configs DROP COLUMN pyfunc_config; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
-- Adds py_func_ref_config to table. | ||
-- Adds pyfunc_config to table. | ||
ALTER TABLE ensembler_configs ADD pyfunc_config jsonb; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
-- Migrate pyfunc_config data from new schema to old schema (remove the env column) | ||
UPDATE ensembler_configs | ||
SET pyfunc_config = (SELECT json_build_object( | ||
'timeout', pyfunc_config ->> 'timeout', | ||
'project_id', (pyfunc_config ->> 'project_id')::int, | ||
'ensembler_id', (pyfunc_config ->> 'ensembler_id')::int, | ||
'resource_request', (pyfunc_config ->> 'resource_request')::jsonb | ||
)) | ||
WHERE type ='pyfunc'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
-- Migrate pyfunc_config data from old schema to new schema (with new 'env' field set as an empty array by default) | ||
UPDATE ensembler_configs | ||
SET pyfunc_config = (SELECT json_build_object( | ||
'env', '[]'::jsonb, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure if this is really necessary since the only pyfunc ensemblers that have been created without this field are the ones in dev, but for consistency's sake I thought having a migration script for this would make things neater. Alternatively, we could consider implementing some lazy migration of the saved pyfunc ensemblers in the API? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually I feel it's better to not have this in the migration, just to keep the migration history lean. This feature is still under development. :) We don't really need to worry since we haven't cut any release with migration file # 10 (and as a consequence, we also haven't released this feature to our internal users, as you've noted). We can run this data migration manually on the internal dev DB. |
||
'timeout', pyfunc_config ->> 'timeout', | ||
'project_id', (pyfunc_config ->> 'project_id')::int, | ||
'ensembler_id', (pyfunc_config ->> 'ensembler_id')::int, | ||
'resource_request', (pyfunc_config ->> 'resource_request')::jsonb | ||
)) | ||
WHERE type ='pyfunc'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ import React, { useContext } from "react"; | |
import { EuiDescriptionList } from "@elastic/eui"; | ||
import EnsemblersContext from "../../../../../providers/ensemblers/context"; | ||
|
||
export const PyFuncRefConfigTable = ({ config: { ensembler_id } }) => { | ||
export const PyFuncConfigTable = ({ config: { ensembler_id } }) => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed this for consistency |
||
const { ensemblers } = useContext(EnsemblersContext); | ||
|
||
const ensembler_name = Object.values(ensemblers) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tip: this can be simplified using the
-
operator like: https://stackoverflow.com/a/35283553