...
Code Block |
---|
def actor_name(integer0, integer1, double0, double1, core_profiles0, core_profiles1, equilibrium0, exec_type='ctypesmpi_local', **kwargsmpi_process = 4, strip_output = True): |
Input arguments required by user C++/F method
...
- very long list of arguments it - it is easy to make a mistake:
- providing incorrect number of arguments
- it is easy to make a mistake providing incorrect order of arguments
- lack of important information, so many features are not handled:
- no debug mode
- MPI parameters - only number of nodes is specified
- no batch mode
Wrapper API - new design
Code Block |
---|
def actor_name(code_args = None, xml_parameters = None, job_settings = None):
return None.
# no returned values! |
Assumptions:
- NO BACKWARD COMPATIBILITY
- 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
- diagnostic info
- execution modes
- return values - autogenerated
- job settings
- The order of arguments (classes) will be arbitrary - implemented as arguments list (*args) or keyword arguments list (**kwargs)
- All arguments (classes) 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 within , and copied to a wrapper package
- Order of attributes corresponds to order of user function arguments
- Every attribute is a class FC2PyArgument 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
Code Block | ||
---|---|---|
| ||
class ToolNameArgument :
def __init__(self, name, type, sub_type, intent):
self.name = name #'argument name'
self.type = type # (INT, DOUBLE, STRING, COMPLEX, IDS)
self.sub_type = sub_type #'equilibrium' for IDSes only
self.intent = intent # (IN/OUT)
self.value = 7. # to be set by user
class ToolNameDiagnosticInfo :
def __init__(self):
self.status
self.message
# AUTO GENERATED !
class <ActorName>Arguments :
def __init__(self):
self.arg1 = ToolNameArgument( 'InVar', int, None, IN)
self.arg2 = ToolNameArgument( 'OutVar', double, None, OUT) |
XML parameters of user C++/F method
- Not passed as wrapper argument
- Defined (path to XML file) at the time of actor creation by FC2Py ToolName
Job settings
- A class passed as wrapper arguments
- Tree (of classes) describing job settings
- FC2PyJobSettings ToolNameJobSettings class:
- batch_job - class FC2PyBatchJobToolNameBatchJob:
- queue
- ???
- debug - class FC2PyDebugToolNameDebug
- debugger - TotalView/gdb
- mode - attach/standalone
- mpi - class FC2PyMPIToolNameMPI
- mpi parameters - TBD
- ???
- open_mp - class FC2PyOpenMPToolNameOpenMP
- openMP parameters - TBD
- ???
- sandbox
- path to sandbox
- sandbox 'lifetime'
- batch_job - class FC2PyBatchJobToolNameBatchJob:
...