@@ -34,11 +34,23 @@ class Containerized(AbstractCode):
3434 _KEY_ATTRIBUTE_ENGINE_COMMAND : str = 'engine_command'
3535 _KEY_ATTRIBUTE_IMAGE : str = 'image'
3636 _KEY_ATTRIBUTE_ESCAPE_EXEC_LINE : str = 'escape_exec_line'
37-
38- def __init__ (self , engine_command : str , image : str , escape_exec_line : bool = False , ** kwargs ):
37+ _KEY_ATTRIBUTE_INNER_MPI : str = 'inner_mpi'
38+ _KEY_ATTRIBUTE_MPI_ARGS : str = 'mpi_args'
39+
40+ def __init__ (
41+ self ,
42+ engine_command : str ,
43+ image : str ,
44+ inner_mpi : bool = False ,
45+ mpi_args : str = '' ,
46+ escape_exec_line : bool = False ,
47+ ** kwargs
48+ ):
3949 super ().__init__ (** kwargs )
4050 self .engine_command = engine_command
4151 self .image = image
52+ self .inner_mpi = inner_mpi
53+ self .mpi_args = mpi_args
4254 self .escape_exec_line = escape_exec_line
4355
4456 @property
@@ -62,6 +74,16 @@ def engine_command(self, value: str) -> None:
6274
6375 self .base .attributes .set (self ._KEY_ATTRIBUTE_ENGINE_COMMAND , value )
6476
77+ @property
78+ def mpi_args (self ) -> str :
79+ return self .base .attributes .get (self ._KEY_ATTRIBUTE_MPI_ARGS )
80+
81+ @mpi_args .setter
82+ def mpi_args (self , value : str ) -> None :
83+ type_check (value , str )
84+
85+ self .base .attributes .set (self ._KEY_ATTRIBUTE_MPI_ARGS , value )
86+
6587 @property
6688 def escape_exec_line (self ) -> bool :
6789 """True for escape whole execute line after engine command in double quotes.
@@ -80,6 +102,16 @@ def escape_exec_line(self, value: bool) -> None:
80102
81103 self .base .attributes .set (self ._KEY_ATTRIBUTE_ESCAPE_EXEC_LINE , value )
82104
105+ @property
106+ def inner_mpi (self ) -> bool :
107+ return self .base .attributes .get (self ._KEY_ATTRIBUTE_INNER_MPI )
108+
109+ @inner_mpi .setter
110+ def inner_mpi (self , value : bool ) -> None :
111+ type_check (value , bool )
112+
113+ self .base .attributes .set (self ._KEY_ATTRIBUTE_INNER_MPI , value )
114+
83115 @property
84116 def image (self ) -> str :
85117 """The image of container
@@ -107,6 +139,12 @@ def get_engine_command(self) -> str:
107139
108140 return cmdline .split ()
109141
142+ def get_mpirun_command (self ) -> list :
143+ """Return the mpi_args in terms of code."""
144+ mpi_args = self .mpi_args
145+
146+ return mpi_args .split ()
147+
110148 @classmethod
111149 def _get_cli_options (cls ) -> dict :
112150 """Return the CLI options that would allow to create an instance of this class."""
0 commit comments