lsmo-epfl / aiida-lsmo

AiiDA workflows for the LSMO laboratory at EPFL
Other
9 stars 13 forks source link

problems running "test_Cp2kBindingEnergy_CO2_MOF74.py" #85

Closed mpougin closed 3 years ago

mpougin commented 3 years ago

When tryin to run (./test_Cp2kBindingEnergy_CO2_MOF74.py --cp2k-code cp2k-8.1@helvetios) the test for the cp2k bindingenergy workchain I get the following error:

./test_Cp2kBindingEnergy_CO2_MOF74.py: line 2: Test/example for the BindingEnergyWorkChain: No such file or directory import-im6.q16: unable to open X server' @ error/import.c/ImportImageCommand/358. import-im6.q16: unable to open X server ' @ error/import.c/ImportImageCommand/358. import-im6.q16: unable to open X server' @ error/import.c/ImportImageCommand/358. from: can't read /var/mail/aiida.plugins from: can't read /var/mail/aiida from: can't read /var/mail/aiida from: can't read /var/mail/aiida.orm ./test_Cp2kBindingEnergy_CO2_MOF74.py: line 15: syntax error near unexpected token (' ./test_Cp2kBindingEnergy_CO2_MOF74.py: line 15:BindingEnergyWorkChain = WorkflowFactory('lsmo.cp2k_binding_energy')'`

Do I see it right that it chokes on the second line? I then tried verdi run test_Cp2kBindingEnergy_CO2_MOF74.py --cp2k-code cp2k-8.1@helvetios but it seems it can't import the DATA_DIR

Traceback (most recent call last): File "/home/miriam/anaconda3/envs/aiida/bin/verdi", line 12, in <module> sys.exit(verdi()) File "/home/miriam/anaconda3/envs/aiida/lib/python3.8/site-packages/click/core.py", line 829, in __call__ return self.main(*args, **kwargs) File "/home/miriam/anaconda3/envs/aiida/lib/python3.8/site-packages/click/core.py", line 782, in main rv = self.invoke(ctx) File "/home/miriam/anaconda3/envs/aiida/lib/python3.8/site-packages/click/core.py", line 1259, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/home/miriam/anaconda3/envs/aiida/lib/python3.8/site-packages/click/core.py", line 1066, in invoke return ctx.invoke(self.callback, **ctx.params) File "/home/miriam/anaconda3/envs/aiida/lib/python3.8/site-packages/click/core.py", line 610, in invoke return callback(*args, **kwargs) File "/home/miriam/aiida1/aiida-core/aiida/cmdline/utils/decorators.py", line 65, in wrapper return wrapped(*args, **kwargs) File "/home/miriam/aiida1/aiida-core/aiida/cmdline/commands/cmd_run.py", line 147, in run exec(compile(handle.read(), scriptname, 'exec', dont_inherit=True), globals_dict) # yapf: disable # pylint: disable=exec-used File "test_Cp2kBindingEnergy_CO2_MOF74.py", line 12, in <module> from . import DATA_DIR ImportError: attempted relative import with no known parent package

I ran the __init__.py file before (verdi run __init__.py), I thought this should assign the directory. Did I do this correct?

I then made my own test_submission script with lowered cp2k settings (see attached). It works fine with one of my structures (results within 10 minutes). But trying to run it with the example cifs the workchain gets stuck in the BSSE calculation (see image). I retried several times, it always stops at the same point. I don't get any errors, it's just in the "RUNNING" state for 24h without any change.

@ltalirz or @danieleongari, do you have an idea what the problem is? Cp2k_BindingEnergyWC_test.txt Unbenannt

ltalirz commented 3 years ago

Hi @mpougin , it seems this particular test script is missing the shebang #!/usr/bin/env python https://github.com/lsmo-epfl/aiida-lsmo/blob/526b1200d98c36fa0d0497c2b8b1632ccd69a2f2/examples/test_Cp2kBindingEnergy_CO2_MOF74.py#L1

You'll be able to run it with python ... just fine. In any case, could you please open a PR to add the shebang? Thanks!

mpougin commented 3 years ago

Thanks for your help @ltalirz. I will do this

mpougin commented 3 years ago

I added the shebang but I still can't run (all) the test workchains. It seems it doesn't recognize the DATA_DIR

Traceback (most recent call last): File "./test_Cp2kBindingEnergy_CO2_MOF74.py", line 13, in <module> from . import DATA_DIR ImportError: attempted relative import with no known parent package

It looks like the __init__.py is not invoked. I tried with verdi run to run it but this doesn't work. @ltalirz did I forget something?

ltalirz commented 3 years ago

hmm I see - for some reason this isn't picked up when the tests are run via pytest. You may just need to copy the code to get the data dir from the __init__.py into the script directly

mpougin commented 3 years ago

thanks for your help @ltalirz, shall I add the DATA_DIR import to the other tests? They don't run for me without as well

ltalirz commented 3 years ago

indeed - I didn't want to force you to do all but of course that would make sense