@@ -622,6 +622,7 @@ def scriptdel(self, key: AnyStr) -> str:
622
622
res = self .execute_command (* args )
623
623
return res if not self .enable_postprocess else processor .scriptdel (res )
624
624
625
+ @deprecated (version = "1.2.0" , reason = "Use scriptexecute instead" )
625
626
def scriptrun (
626
627
self ,
627
628
key : AnyStr ,
@@ -642,7 +643,7 @@ def scriptrun(
642
643
Tensor(s) which is already saved in the RedisAI using a tensorset call. These
643
644
tensors will be used as the input for the modelrun
644
645
outputs : Union[AnyStr, List[AnyStr]]
645
- keys on which the outputs to be saved. If those keys exist already, modelrun
646
+ keys on which the outputs to be saved. If those keys exist already, scriptrun
646
647
will overwrite them with new values
647
648
648
649
Returns
@@ -662,37 +663,38 @@ def scriptrun(
662
663
def scriptexecute (
663
664
self ,
664
665
key : AnyStr ,
665
- function : AnyStr ,
666
+ function : str ,
666
667
keys : Union [AnyStr , Sequence [AnyStr ]],
667
- inputs : Union [AnyStr , Sequence [AnyStr ]] = None ,
668
- list_inputs : Sequence [Sequence [AnyStr ]] = None ,
668
+ inputs : Union [AnyStr , Sequence [Union [AnyStr , Sequence [AnyStr ]]]] = None ,
669
669
outputs : Union [AnyStr , Sequence [AnyStr ]] = None ,
670
670
timeout : int = None ,
671
671
) -> str :
672
672
"""
673
- Run an already set script. Similar to modelrun
673
+ Run an already set script. Similar to modelexecute
674
674
675
675
Parameters
676
676
----------
677
677
key : AnyStr
678
678
Script key
679
- function : AnyStr
679
+ function : str
680
680
Name of the function in the ``script``
681
681
keys : Union[AnyStr, Sequence[AnyStr]]
682
682
Either a squence of key names that the script will access before, during and
683
683
after its execution, or a tag which all those keys share.
684
- inputs : Union[AnyStr, List[AnyStr]]
685
- Tensor(s) which is already saved in the RedisAI using a tensorset call. These
686
- tensors will be used as the input for the modelrun
687
- list_inputs : Sequence[Sequence[AnyStr]]
688
- list of inputs.
684
+ inputs : Union[AnyStr, Sequence[Union[AnyStr, Sequence[AnyStr]]]]
685
+ The inputs can be tensor key name, string , int or float.
686
+ These inputs will be used as the input for the scriptexecute function.
687
+ The order of the input should be aligned with the order of their respected
688
+ parameter at the function signature.
689
+ When one of the elements in the inputs list is a list (or a tuple), that element
690
+ will be treated as LIST_INPUTS in the command executaion.
689
691
outputs : Union[AnyStr, List[AnyStr]]
690
- keys on which the outputs to be saved. If those keys exist already, modelrun
691
- will overwrite them with new values
692
+ keys on which the outputs to be saved. If those keys exist already, scriptexecute
693
+ will overwrite them with new values.
692
694
timeout : int
693
695
The max number on milisecinds that may pass before the request is prossced
694
696
(meaning that the result will not be computed after that time and TIMEDOUT
695
- is returned in that case)
697
+ is returned in that case).
696
698
697
699
Returns
698
700
-------
@@ -703,10 +705,15 @@ def scriptexecute(
703
705
-------
704
706
>>> con.scriptexecute('ket', 'bar', keys=['a', 'b', 'c'], inputs=['a', 'b'], outputs=['c'])
705
707
'OK'
708
+ >>> con.scriptexecute('myscript{tag}', 'addn',
709
+ >>> keys=['{tag}'],
710
+ >>> inputs=['mytensor1{tag}', ['mytensor2{tag}', 'mytensor3{tag}']],
711
+ >>> outputs=['result{tag}'])
712
+ 'OK'
706
713
"""
707
- args = builder .scriptexecute (key , function , keys , inputs , list_inputs , outputs , timeout )
714
+ args = builder .scriptexecute (key , function , keys , inputs , outputs , timeout )
708
715
res = self .execute_command (* args )
709
- return res if not self .enable_postprocess else processor .scriptrun (res )
716
+ return res if not self .enable_postprocess else processor .scriptexecute (res )
710
717
711
718
def scriptscan (self ) -> List [List [AnyStr ]]:
712
719
"""
0 commit comments