Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
def actor_name(code_args = None, xml_parameters = None, job_settings = None):
	return None.  

# no returned values!


Assumptions:

General:

  • Python version 3.6+
  • Programming conventions (PEP 8?)
  • NO BACKWARD COMPATIBILITY (warning) - Incompatibility with existing Python actors!
  • All input arguments (user method arg and info determining how to launch job ) 'structured' within classes
  • Classes will be defined for:
    • user code arguments - autogenerated
    • XML input parameters
    • job settings
  • The order of arguments  will be arbitrary - implemented as arguments list (*args) or keyword arguments list (**kwargs)
  • All arguments will be optional. If object of given class will be not provided - default values will be used.

...

  • All arguments 'packed' within a class <ActorName>Arguments
  • Class will be automatically generated, and copied to a wrapper package
  • Order of attributes corresponds to order of  user function arguments
  • Every attribute is a class ToolNameArgument keeping not only value but also metadata describing argument:
    • Name
    • Type of value
    • Value
    • IN or OUT
  • Attributes' setters/getters will be overridden - user will set only value of argument 
    • To reduce complexity visible by user
    • To check if arg type is correct
Info
titleToolName

All code samples below use <ToolName> as a prefix of classes. Once we decide on the name, all the classes will contain it as a part of the name in each class that is not actor dependent.


Code Block
languagepy
# AUTO GENERATED !
class <ActorName>Arguments :  
  def __init__(self):
    self.arg1 = ToolNameArgument( 'InVar', int, None, IN)
    self.arg2 = ToolNameArgument( 'OutVar', double, None, OUT)
	self.diagnostic_info = ToolNameDiagnosticInfo()

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
class ToolNameArgument :
  def __init__(self, name, type, sub_type, intent):
    self.name =  name #'argument name' READ ONLY
	self.type = type # (INT, DOUBLE, STRING, COMPLEX, IDS) READ ONLY
	self.sub_type = sub_type  #'equilibrium'  for IDSes only READ ONLY
	self.intent = intent # (IN/OUT) READ ONLY
	self.value  = 7. # to be set by user
    
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
class ToolNameDiagnosticInfo :
  def __init__(self):
    self.status  
	self.message

...

  • OUT arguments - wrapper will update fields of <ActorName>Arguments class

Open points

...

  1. https://www.python.org/dev/peps/pep-0008/

...

  1. Only IN and OUT arguments (no INOUT arguments)
  2. Arrays as an inout of user method- only "dynamic" - i.e. of variable size 
  3. Wrapper results:
    1. OUT arguments - wrapper will update fields of <ActorName>Arguments class
    2. INCOMPATIBILITY 
  4. Diagnostic info 
    1. Info returned from user method
      1. status flag
      2. user defined message
    2. 'Q: can it be mandatory in user sbrt?
  5.  Sandbox:
    1. Do we need this feature?
  6. Alternative library:
    1. Do we need this feature?

...