gafusion / omas

Ordered Multidimensional Array Structure
http://gafusion.github.io/omas
MIT License
32 stars 15 forks source link

Error with load_omas_imas_remote module has no attribute fortran_environment #67

Closed jwscook closed 5 years ago

jwscook commented 5 years ago

Hi OMAS devs,

I'm attempting to use the load_omas_imas_remote functionality from freia at UKAEA. However it is throwing an exception before telling me sensible reasons as to why it won't work, like incorrect pulse number or something.

What I did:

I use module load omfit-dev/20190417 which gives omas and omfit to python 2.7. Then in ipython I do the following

In [1]: from omas import *
In [2]: from omfit.classes.omfit_omas import load_omas_imas_remote
In [3]: ods = load_omas_imas_remote(serverPicker='iter_login', machine='ITER',user='cookj', pulse=123456,
   ...:  run=1)

which gives the error message AttributeError: 'module' object has no attribute 'fortran_environment'. Complete output below:

Loading OMFIT APIs...
Setting up environment...
External imports...
Loading utility functions...
Loading plot utility functions...
Loading widgets utility functions...
Loading tk functions...
Loading fit utility functions...
--------------------
Linux freia053 3.10.0-862.3.3.el7.x86_64 #1 SMP Thu Jun 14 15:28:39 CDT 2018 x86_64 x86_64
v0.26.13-1995-g9af095f6c on branch unstable
Installation type     : PERSONAL
OMFITstartDir         : /home/cookj
OMFITsrc              : /common/transp_shared/omfit/atom-dev/OMFIT-source/omfit
OMFITsettingsDir      : /home/cookj/.OMFIT
OMFITsessionsDir      : /tmp/cookj/OMFIT_local/sessions
OMFITcontrolmastersDir: /tmp/cookj/OMFIT_local/controlmasters
OMFITscriptsBackupDir : /tmp/cookj/OMFIT_scripts_backup
OMFITautosaveDir      : /tmp/cookj/OMFIT_projects_autosave
OMFITtmpDir           : /tmp/cookj/OMFIT
OMFITsessionDir       : /tmp/cookj/OMFIT/OMFIT_2019-04-24_08_58_59_912441
OMFITcwd              : /tmp/cookj/OMFIT/OMFIT_2019-04-24_08_58_59_912441/project
--------------------
Time to load startup_framework: 1.29012 seconds
Loading OMFIT classes...
Loading widgets utility functions...
Loading plot utility functions...
UserWarning: No `boutdata` and `boututils` support (BOUT_TOP environment variable): ImportError('No module named boutdata',) (omfit_bout.py@37)
UserWarning: No `pact.pdb` format support: ImportError('No module named pact.pdb',) (omfit_pdb.py@21)
UserWarning: No `CDB` support (CDB_PATH environment variable): ImportError('No module named pyCDB',) (omfit_cdb.py@33)
UserWarning: No GACODE support ($GACODE_ROOT=''): ImportError('No module named tgyro.data',) (omfit_gacode.py@59)
Offending module: omfit_namelist
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-3-50092e1bdf4b> in <module>()
----> 1 ods = load_omas_imas_remote(serverPicker='iter_login', machine='ITER',user='cookj', pulse=123456, run=1)

/common/transp_shared/omfit/atom-dev/OMFIT-source/omfit/classes/omfit_omas.pyc in load_omas_imas_remote(serverPicker, **kw)
    159     :param \**kw: all other parameters are passed to the load_omas_imas function
    160     """
--> 161     return _base_omas_remote(serverPicker, 'load_omas_imas', **kw)
    162 try:
    163     load_omas_imas_remote.__doc__ += load_omas_imas.__doc__.replace('\n    ', '\n        ')

/common/transp_shared/omfit/atom-dev/OMFIT-source/omfit/classes/omfit_omas.pyc in _base_omas_remote(serverPicker, target_function, python_script, python, quiet, forceRemote, IMAS_module, OMAS_module, UDA_module, **kw)
    122 python'''
    123 
--> 124     import OMFITx
    125     return OMFITxAttributeError: 'module' object has no attribute 'fortran_environment'.remote_python(None,
    126                                 executable=python + ' -u %s',

/common/transp_shared/omfit/atom-dev/OMFIT-source/omfit/classes/OMFITx.py in <module>()
      5 print('Loading OMFIT APIs...')
      6 
----> 7 from omfit_tree import *
      8 from utils_widgets import _defaultFont
      9 from classes.utils_base import _streams

/common/transp_shared/omfit/atom-dev/OMFIT-source/omfit/omfit_tree.py in <module>()
     59         if _python_module != 'omfit_base':
     60             for item in getattr(classes, _python_module).__all__:
---> 61                 setattr(classes.omfit_base, item, getattr(getattr(classes, _python_module), item))
     62 
     63         if _python_module != 'omfit_python':

AttributeError: 'module' object has no attribute 'fortran_environment'

Any ideas how to fix this?

Thanks, James

orso82 commented 5 years ago

@jwscook you found a bug, which was resolved with https://github.com/gafusion/OMFIT-source/commit/c17625164c719f430cb9b036a7d4da498fe1ac7b

Still, what you are trying to do in iPython will not work.

OMAS itself does not have remote access capabilities. These are made available by OMFIT, using the infrastructure that the framework provides for handling remote connections, transferring of files, and executing remote code. This means that if you want to use such functionality you must start the OMFIT framework and work from within its environment.

Alternatively, you can login to the ITER cluster, and start the iPython session there, and use OMAS load_omas_imas routine locally.

Here are some references: https://gafusion.github.io/omas/iter.html https://gafusion.github.io/omas/code.html

To start OMFIT at CCFE follow these instructions: http://gafusion.github.io/OMFIT-source/installations/CCFE.html @fitz-culham can help.

jwscook commented 5 years ago

I see. Thanks.

fitz-culham commented 5 years ago

That's a bummer.

Does OMFIT really have to be the whole experience with GUI etc? I guess the analogy would be MATLAB with and without the IDE. Similar debates have been raging in UNIX circles for years.

Something to think about @orso82

smithsp commented 5 years ago

@fitz-culham No there does not have to be a GUI for OMFIT. But @jwscook should test the method first with the GUI, then he can transfer what he is doing out of the GUI to a script, such as https://github.com/gafusion/OMFIT-source/blob/unstable/regression/test_small_script.py and then the small script can be run as omfit <path_to_script>

Now that is probably not what is wanted. So I looked at running python in inspection mode with -i. With https://github.com/gafusion/OMFIT-source/commit/6f614ddaaa15e423df1b902ba87ead9b59fca3cd you can do python -i omfit/omfit.py regression/test_small_script.py which then leaves OMFIT in your namespace. The script can be rerun as shown here: image Note that assigning the results of the script run to a variable (tmp in the example) is vital, as otherwise a large namespace is printed. Also running with runNoGUI is necessary for now; @orso82 this should be considered a bug (possibly reported by @gtrevisan on OMFIT), as a blank tk window should not be launched when run with .run when there is no main OMFIT GUI.

@fitz-culham @jwscook Feedback is welcome.