File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed
Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -721,6 +721,11 @@ impl Console {
721721 }
722722 }
723723
724+ /// Get the active execute request, if any.
725+ pub ( crate ) fn get_active_execute_request ( & self ) -> Option < & ExecuteRequest > {
726+ self . active_request . as_ref ( ) . map ( |req| & req. request )
727+ }
728+
724729 /// Get the current execution context if an active request exists.
725730 /// Returns (execution_id, code) tuple where execution_id is the Jupyter message ID.
726731 pub ( crate ) fn get_execution_context ( & self ) -> Option < ( String , String ) > {
@@ -2790,3 +2795,16 @@ unsafe extern "C-unwind" fn ps_get_virtual_document(uri: SEXP) -> anyhow::Result
27902795 None => Ok ( RObject :: null ( ) . sexp ) ,
27912796 }
27922797}
2798+
2799+ /// Returns the currently active execute request as an R named list,
2800+ /// or NULL if no execute request is in flight.
2801+ #[ harp:: register]
2802+ pub unsafe extern "C-unwind" fn ps_get_active_request ( ) -> anyhow:: Result < SEXP > {
2803+ let Some ( req) = Console :: get ( ) . get_active_execute_request ( ) else {
2804+ return Ok ( libr:: R_NilValue ) ;
2805+ } ;
2806+
2807+ let json = serde_json:: to_value ( req) ?;
2808+ let r_obj = RObject :: try_from ( json) ?;
2809+ Ok ( r_obj. sexp )
2810+ }
Original file line number Diff line number Diff line change 5656 ark_version
5757}
5858
59+ # Return the active (in flight) execute_request data structure; useful for
60+ # inspecting what metadata has been sent from the front end.
61+ #
62+ # Internal utility; invoke with: `.ps.internal(active_request())`
63+ active_request <- function () {
64+ .ps.Call(" ps_get_active_request" )
65+ }
66+
5967# Sleep that doesn't check for interrupts to test an unresponsive runtime.
6068# ' @export
6169.ps.deep_sleep <- function (secs ) {
You can’t perform that action at this time.
0 commit comments