-
Notifications
You must be signed in to change notification settings - Fork 727
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
[@card] Realtime cards (3/N) #1552
Conversation
MetaflowCard
classes support realtime behavior9a27a2b
to
eba36be
Compare
c2ed928
to
66d3bea
Compare
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.
Minor nit but I think LGTM.
eba36be
to
4bb9032
Compare
66d3bea
to
5e05ed6
Compare
4bb9032
to
e5e870f
Compare
5e05ed6
to
4816fb0
Compare
4816fb0
to
eb56ecb
Compare
e5e870f
to
d5f8c75
Compare
eb56ecb
to
bb156d6
Compare
d5f8c75
to
fa23ad4
Compare
bb156d6
to
505c7ab
Compare
fa23ad4
to
272346a
Compare
505c7ab
to
48f4936
Compare
272346a
to
57e3a7e
Compare
48f4936
to
d100a35
Compare
d100a35
to
7502704
Compare
087fe3e
to
2a8501a
Compare
28b49f3
to
04930e7
Compare
2a8501a
to
be176e3
Compare
04930e7
to
4ce5958
Compare
disable_updates: bool, optional | ||
A boolean value to disable realtime updates for all components within the table. Default: False |
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.
Surface level API change to disable table updates when we want. cc @tuulos
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.
do you have a particular use case in mind for this Table-level disable_updates
?
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.
Will Remove docstring cc @tuulos ; So that it's not a part of the public API
def __init__(self, max=100, label=None, value=0, unit=None, metadata=None): | ||
self._label = label | ||
self._max = max | ||
self._value = value | ||
self._unit = unit | ||
self._metadata = metadata | ||
|
||
def update(self, new_value, metadata=None): | ||
self._value = new_value | ||
if metadata is not None: | ||
self._metadata = metadata | ||
|
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.
User API signature needs validation : cc @tuulos
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.
what's metadata
?
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.
def __init__(self, spec, data=None): | ||
self._spec = spec | ||
self._data = data | ||
|
||
def update(self, data=None, spec=None): | ||
if spec is not None: | ||
self._spec = spec | ||
if data is not None: | ||
self._data = data | ||
|
||
@classmethod | ||
def from_altair_chart(cls, altair_chart): |
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.
User API signature needs validation : cc @tuulos
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.
if I create a chart with from_altair_chart
initially, do I then update the data with update(spec=None, data=my_data)
or how would it work?
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.
Yes I think you should be able to as long as the data object is the "full object"; The VegaChart object needs the full data object in the data update.
self._spec = spec | ||
self._data = data | ||
|
||
def update(self, data=None, spec=None): |
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.
spec
is a JSON (a Python dict?) following the VegaLite spec here, right?
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.
Yes
be176e3
to
78c7154
Compare
4ce5958
to
c0e510a
Compare
@@ -82,20 +82,28 @@ class Artifact(UserComponent): | |||
Use a truncated representation. | |||
""" | |||
|
|||
REALTIME_UPDATABLE = True | |||
|
|||
def update(self, artifact): |
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.
Cc @tuulos
self._spec = spec | ||
self._data = data | ||
|
||
def update(self, data=None, spec=None): |
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.
Yes
def __init__(self, max=100, label=None, value=0, unit=None, metadata=None): | ||
self._label = label | ||
self._max = max | ||
self._value = value | ||
self._unit = unit | ||
self._metadata = metadata | ||
|
||
def update(self, new_value, metadata=None): | ||
self._value = new_value | ||
if metadata is not None: | ||
self._metadata = metadata | ||
|
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.
def __init__(self, spec, data=None): | ||
self._spec = spec | ||
self._data = data | ||
|
||
def update(self, data=None, spec=None): | ||
if spec is not None: | ||
self._spec = spec | ||
if data is not None: | ||
self._data = data | ||
|
||
@classmethod | ||
def from_altair_chart(cls, altair_chart): |
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.
Yes I think you should be able to as long as the data object is the "full object"; The VegaChart object needs the full data object in the data update.
disable_updates: bool | ||
Disable realtime updates for the image. Default: True |
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.
Will Remove docstring cc @tuulos ; So that it's not a part of the public API
disable_updates: bool, optional | ||
A boolean value to disable realtime updates for all components within the table. Default: False |
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.
Will Remove docstring cc @tuulos ; So that it's not a part of the public API
b55df99
to
93329b3
Compare
31f714b
to
8158bd8
Compare
…vior - Markdown and Artifact Component made realtime. - default/blank cards made realtime - default component ids to realtime-updatable UserComponents
- Add a variable in the HTML template to enable/disable `metaflow_card_update` function
- Set options that allows disabling realtime updates for components that may have lots of data like `Image` / `Table`. This can be useful when we are calling refresh often and don't want to update data which maybe static.
- Image.update supports multi-type object - remove `disable_updates` from public api
- property in vega chart to show controls - remove `data` argument from Vega Chart. - It only takes `spec` as an argument. - VegaChart default width set to `container`
3e7e4a0
to
cf28b1f
Compare
615ffe4
to
947c2ec
Compare
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.
Haven't looked at things in great detail but I plan to test everything once it is all merged over the next week. My only big comment is that we should add docstrings/typehints to anything the user will use.
|
||
REALTIME_UPDATABLE = True | ||
|
||
def __init__(self, max=100, label=None, value=0, unit=None, metadata=None): |
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.
I'm going to be a stickler and say we should add type hints and docs :)
* [card-server] cli command to expose a card server - Server helps view realtime updates - Added a card viewer html file - Created a simple HTTP based card server that will help showcase the realtime cards from querying the server - The API response contains the task status for the data api - reload on run change : A background thread checks if there are new runs created via the latest_run file. - pass down poll_interval to card viewer - card server is also resiliant to no runs - You can set `METAFLOW_DEBUG_CARD_SERVER` to debug card server logs, Logging is off by default - clean url parsing for requests : needed to ensure calls to card server are resiliant to query params in requests. - also need clean url parsing for setting `embed` query param in the card iframe - run-info API sends task finished information which is useful when switching cards automatically when new tasks start. - it Always logs when run-ids change * [card-viewer-html] UI + Structure - Cleanup HTML template - Handles edge case where no runs are available - Shows errors when things are not working - leverages a configurable poll interval - set `embed` query param in the card iframe source. - it automatically switches to new card when tasks finish and other tasks are running. - Fix bug when card data is not available - checks for `final` reload token to stop polling updates * [@card] [card-core] always call `refresh` after first `render_runtime` (5/N) (#1670) * [card-core] always call `refresh` after first `render_runtime` - Added a `sync` argument to the card creator [@card][bug fixes] Address comments and squashing bugs (6/N) (#1678) * [card-components] type-hints + doc string Fix. * [card-core] fix function signature in tests. * [card-server] address comments on debug mode and hygiene * [card-components] vega charts special case inside table --------- Co-authored-by: adam <203779+seethroughdev@users.noreply.github.com>
* [card-components] internal MetaflowCard classes support realtime behavior - Markdown and Artifact Component made realtime. - default/blank cards made realtime - default component ids to realtime-updatable UserComponents * [default-card-python] add runtime check - Add a variable in the HTML template to enable/disable `metaflow_card_update` function * [card-components] progressbar / vegacharts * [card-components] customize updates for Tables/Images - Set options that allows disabling realtime updates for components that may have lots of data like `Image` / `Table`. This can be useful when we are calling refresh often and don't want to update data which maybe static. * [card-components] address comments on Image class - Image.update supports multi-type object - remove `disable_updates` from public api * [card-components][vega-chart][bug-fix] - property in vega chart to show controls - remove `data` argument from Vega Chart. - It only takes `spec` as an argument. - VegaChart default width set to `container` * [@card] Realtime cards (4/N) (#1553) * [card-server] cli command to expose a card server - Server helps view realtime updates - Added a card viewer html file - Created a simple HTTP based card server that will help showcase the realtime cards from querying the server - The API response contains the task status for the data api - reload on run change : A background thread checks if there are new runs created via the latest_run file. - pass down poll_interval to card viewer - card server is also resiliant to no runs - You can set `METAFLOW_DEBUG_CARD_SERVER` to debug card server logs, Logging is off by default - clean url parsing for requests : needed to ensure calls to card server are resiliant to query params in requests. - also need clean url parsing for setting `embed` query param in the card iframe - run-info API sends task finished information which is useful when switching cards automatically when new tasks start. - it Always logs when run-ids change * [card-viewer-html] UI + Structure - Cleanup HTML template - Handles edge case where no runs are available - Shows errors when things are not working - leverages a configurable poll interval - set `embed` query param in the card iframe source. - it automatically switches to new card when tasks finish and other tasks are running. - Fix bug when card data is not available - checks for `final` reload token to stop polling updates * [@card] [card-core] always call `refresh` after first `render_runtime` (5/N) (#1670) * [card-core] always call `refresh` after first `render_runtime` - Added a `sync` argument to the card creator [@card][bug fixes] Address comments and squashing bugs (6/N) (#1678) * [card-components] type-hints + doc string Fix. * [card-core] fix function signature in tests. * [card-server] address comments on debug mode and hygiene * [card-components] vega charts special case inside table --------- Co-authored-by: adam <203779+seethroughdev@users.noreply.github.com> --------- Co-authored-by: adam <203779+seethroughdev@users.noreply.github.com>
* [default-card][ui] default card realtime updatable - cleanup the ui component code and add naive progress-bar * [default-card][ui] Add custom progress bar * [default-card][ui] vegachart component - Chart support within tables and anywhere across the page - Chart mutation done based on spec/data changes. * [default-card][ui] remove chart.js deps. * [default-card][ui] migrate to vite * [default-card][ui] update progress bar styles * [default-card][ui] Fixes to chart/css/progess bar - pass down options in vega chart - progress-bar min width for mf UI - Fix bug when vega-chart spec changes. - fix `embed` class CSS * [@card] Realtime cards (3/N) (#1552) * [card-components] internal MetaflowCard classes support realtime behavior - Markdown and Artifact Component made realtime. - default/blank cards made realtime - default component ids to realtime-updatable UserComponents * [default-card-python] add runtime check - Add a variable in the HTML template to enable/disable `metaflow_card_update` function * [card-components] progressbar / vegacharts * [card-components] customize updates for Tables/Images - Set options that allows disabling realtime updates for components that may have lots of data like `Image` / `Table`. This can be useful when we are calling refresh often and don't want to update data which maybe static. * [card-components] address comments on Image class - Image.update supports multi-type object - remove `disable_updates` from public api * [card-components][vega-chart][bug-fix] - property in vega chart to show controls - remove `data` argument from Vega Chart. - It only takes `spec` as an argument. - VegaChart default width set to `container` * [@card] Realtime cards (4/N) (#1553) * [card-server] cli command to expose a card server - Server helps view realtime updates - Added a card viewer html file - Created a simple HTTP based card server that will help showcase the realtime cards from querying the server - The API response contains the task status for the data api - reload on run change : A background thread checks if there are new runs created via the latest_run file. - pass down poll_interval to card viewer - card server is also resiliant to no runs - You can set `METAFLOW_DEBUG_CARD_SERVER` to debug card server logs, Logging is off by default - clean url parsing for requests : needed to ensure calls to card server are resiliant to query params in requests. - also need clean url parsing for setting `embed` query param in the card iframe - run-info API sends task finished information which is useful when switching cards automatically when new tasks start. - it Always logs when run-ids change * [card-viewer-html] UI + Structure - Cleanup HTML template - Handles edge case where no runs are available - Shows errors when things are not working - leverages a configurable poll interval - set `embed` query param in the card iframe source. - it automatically switches to new card when tasks finish and other tasks are running. - Fix bug when card data is not available - checks for `final` reload token to stop polling updates * [@card] [card-core] always call `refresh` after first `render_runtime` (5/N) (#1670) * [card-core] always call `refresh` after first `render_runtime` - Added a `sync` argument to the card creator [@card][bug fixes] Address comments and squashing bugs (6/N) (#1678) * [card-components] type-hints + doc string Fix. * [card-core] fix function signature in tests. * [card-server] address comments on debug mode and hygiene * [card-components] vega charts special case inside table --------- Co-authored-by: adam <203779+seethroughdev@users.noreply.github.com> --------- Co-authored-by: adam <203779+seethroughdev@users.noreply.github.com> --------- Co-authored-by: adam <203779+seethroughdev@users.noreply.github.com>
* [default-card][ui] default card realtime updatable - cleanup the ui component code and add naive progress-bar * [default-card][ui] Add custom progress bar * [default-card][ui] vegachart component - Chart support within tables and anywhere across the page - Chart mutation done based on spec/data changes. * [default-card][ui] remove chart.js deps. * [default-card][ui] migrate to vite * [default-card][ui] update progress bar styles * [default-card][ui] Fixes to chart/css/progess bar - pass down options in vega chart - progress-bar min width for mf UI - Fix bug when vega-chart spec changes. - fix `embed` class CSS * [@card] Realtime cards (3/N) (Netflix#1552) * [card-components] internal MetaflowCard classes support realtime behavior - Markdown and Artifact Component made realtime. - default/blank cards made realtime - default component ids to realtime-updatable UserComponents * [default-card-python] add runtime check - Add a variable in the HTML template to enable/disable `metaflow_card_update` function * [card-components] progressbar / vegacharts * [card-components] customize updates for Tables/Images - Set options that allows disabling realtime updates for components that may have lots of data like `Image` / `Table`. This can be useful when we are calling refresh often and don't want to update data which maybe static. * [card-components] address comments on Image class - Image.update supports multi-type object - remove `disable_updates` from public api * [card-components][vega-chart][bug-fix] - property in vega chart to show controls - remove `data` argument from Vega Chart. - It only takes `spec` as an argument. - VegaChart default width set to `container` * [@card] Realtime cards (4/N) (Netflix#1553) * [card-server] cli command to expose a card server - Server helps view realtime updates - Added a card viewer html file - Created a simple HTTP based card server that will help showcase the realtime cards from querying the server - The API response contains the task status for the data api - reload on run change : A background thread checks if there are new runs created via the latest_run file. - pass down poll_interval to card viewer - card server is also resiliant to no runs - You can set `METAFLOW_DEBUG_CARD_SERVER` to debug card server logs, Logging is off by default - clean url parsing for requests : needed to ensure calls to card server are resiliant to query params in requests. - also need clean url parsing for setting `embed` query param in the card iframe - run-info API sends task finished information which is useful when switching cards automatically when new tasks start. - it Always logs when run-ids change * [card-viewer-html] UI + Structure - Cleanup HTML template - Handles edge case where no runs are available - Shows errors when things are not working - leverages a configurable poll interval - set `embed` query param in the card iframe source. - it automatically switches to new card when tasks finish and other tasks are running. - Fix bug when card data is not available - checks for `final` reload token to stop polling updates * [@card] [card-core] always call `refresh` after first `render_runtime` (5/N) (Netflix#1670) * [card-core] always call `refresh` after first `render_runtime` - Added a `sync` argument to the card creator [@card][bug fixes] Address comments and squashing bugs (6/N) (Netflix#1678) * [card-components] type-hints + doc string Fix. * [card-core] fix function signature in tests. * [card-server] address comments on debug mode and hygiene * [card-components] vega charts special case inside table --------- Co-authored-by: adam <203779+seethroughdev@users.noreply.github.com> --------- Co-authored-by: adam <203779+seethroughdev@users.noreply.github.com> --------- Co-authored-by: adam <203779+seethroughdev@users.noreply.github.com>
* [default-card][ui] default card realtime updatable - cleanup the ui component code and add naive progress-bar * [default-card][ui] Add custom progress bar * [default-card][ui] vegachart component - Chart support within tables and anywhere across the page - Chart mutation done based on spec/data changes. * [default-card][ui] remove chart.js deps. * [default-card][ui] migrate to vite * [default-card][ui] update progress bar styles * [default-card][ui] Fixes to chart/css/progess bar - pass down options in vega chart - progress-bar min width for mf UI - Fix bug when vega-chart spec changes. - fix `embed` class CSS * [@card] Realtime cards (3/N) (Netflix#1552) * [card-components] internal MetaflowCard classes support realtime behavior - Markdown and Artifact Component made realtime. - default/blank cards made realtime - default component ids to realtime-updatable UserComponents * [default-card-python] add runtime check - Add a variable in the HTML template to enable/disable `metaflow_card_update` function * [card-components] progressbar / vegacharts * [card-components] customize updates for Tables/Images - Set options that allows disabling realtime updates for components that may have lots of data like `Image` / `Table`. This can be useful when we are calling refresh often and don't want to update data which maybe static. * [card-components] address comments on Image class - Image.update supports multi-type object - remove `disable_updates` from public api * [card-components][vega-chart][bug-fix] - property in vega chart to show controls - remove `data` argument from Vega Chart. - It only takes `spec` as an argument. - VegaChart default width set to `container` * [@card] Realtime cards (4/N) (Netflix#1553) * [card-server] cli command to expose a card server - Server helps view realtime updates - Added a card viewer html file - Created a simple HTTP based card server that will help showcase the realtime cards from querying the server - The API response contains the task status for the data api - reload on run change : A background thread checks if there are new runs created via the latest_run file. - pass down poll_interval to card viewer - card server is also resiliant to no runs - You can set `METAFLOW_DEBUG_CARD_SERVER` to debug card server logs, Logging is off by default - clean url parsing for requests : needed to ensure calls to card server are resiliant to query params in requests. - also need clean url parsing for setting `embed` query param in the card iframe - run-info API sends task finished information which is useful when switching cards automatically when new tasks start. - it Always logs when run-ids change * [card-viewer-html] UI + Structure - Cleanup HTML template - Handles edge case where no runs are available - Shows errors when things are not working - leverages a configurable poll interval - set `embed` query param in the card iframe source. - it automatically switches to new card when tasks finish and other tasks are running. - Fix bug when card data is not available - checks for `final` reload token to stop polling updates * [@card] [card-core] always call `refresh` after first `render_runtime` (5/N) (Netflix#1670) * [card-core] always call `refresh` after first `render_runtime` - Added a `sync` argument to the card creator [@card][bug fixes] Address comments and squashing bugs (6/N) (Netflix#1678) * [card-components] type-hints + doc string Fix. * [card-core] fix function signature in tests. * [card-server] address comments on debug mode and hygiene * [card-components] vega charts special case inside table --------- Co-authored-by: adam <203779+seethroughdev@users.noreply.github.com> --------- Co-authored-by: adam <203779+seethroughdev@users.noreply.github.com> --------- Co-authored-by: adam <203779+seethroughdev@users.noreply.github.com>
[card/components] internal
MetaflowCard
classes support realtime behaviorTODO