Comments (4)
How would you use this? Could you give me an example usage?
from barfi.
Sure. One of the use cases is that the compute blocks go one by one and if there is a non-standard error that is not captured in logging for the app itself, streamlit, or another library the user never sees see what block was executing. Once the execute button is run, everything just kind of runs in the background...
Here's one example.
At the top of the page, initiate a streamlit placeholder with st.empty(). This is overly simplified but should get the point across... The user gets a streamlit info message at the top of the page for every block when it is executing.
execution_block_placeholder = st.empty()
# begin compute engine functions
def my_compute_engine(self):
# compute logic for input_block_1
block_name = self.get_blockname(self) # <--- need to think through this, we don't know the name of the block
block_execution_message = f('Now executing block {block_name}')
execution_execution_block_placeholder.info(block_execution_message)
# we could also have warning, error and other messages here and either re-use execution_block_message
# OR add a new placeholder e.g. warning_block_placeholder = st.empty
input_block_1 = Block(name='Input Block 1')
input_block_1 .add_input(name='Save Orgs and Networks to Local Cache')
input_block_1 .add_compute(my_compute_engine)
from barfi.
@krish-adi - I don't know if this should be filed under a new enhancement req or this one but it would be nice to also get the last block or have an array where we could say block X of Y blocks. Case is to notify the user of which block is currently running and to let them know when all blocks have run successfully (or not). Some blocks may take some time to run with large API datasets. If something goes wrong, need to know where and notify the user in addition to internally with logger.
from barfi.
In v 0.7.0, now each block can store a private state. This state can store anything you want to access after execution. All the errors during the compute function execution of the block are stored in the state. When a block fails, only the blocks dependent on it are skipped, and the rest of the schema is executed.
This rather is the better way of keeping track of the errors and the status when compared to st.empty() or session_state. I didn't want this to rely too much on streamlit's workflow. For the st.empty() the update did not accur as the placeholder object is bounced around from one function to the other.
from barfi.
Related Issues (20)
- A few features : ) HOT 2
- a non backend coupled version, like an open API version HOT 2
- Migrate to baklavajs v2 HOT 1
- Asynchronous execution HOT 3
- Feature Request: Define size of editorCanvas HOT 3
- [Bug]Use same type component multiple times HOT 2
- Need more documentation! HOT 8
- Parameterize the location of saved schemas HOT 1
- Add filtering in “Add Node” HOT 1
- [feat]Is it possible to style node/interface with colors HOT 1
- [Bug] Creating cyclic connections raises exception incorrectly HOT 1
- [Feature Request] Add style parameter to barfi.st_barfi
- [Feature Request] Input/Output decorator with type HOT 1
- Variable number of inputs/outputs
- Do I have to connect manually? Can I use code to create a connection? HOT 1
- Type Error in compute_engine.py After Upgrading to v0.6.0 HOT 2
- Enhancment (with code): Add a delete_schema function in schema_loader.py HOT 1
- Poetry: Migrate to package management to use poetry
- set_option problem HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from barfi.