Read-only version of model download

Asked by Zachary Marshall on 2018-07-09

In new MadGraph versions, it's possible to download and install models that are requested that were missing. I think that's great! When we have an installation in a read-only area, though, it seems to fail. The solution would be to download the model files locally or to a .madgraph directory and then add that directory to PYTHONPATH, so that the model would be picked up by the normal infrastructure. Could such functionality be added, please?

Thanks,
Zach

Question information

Language:
English Edit question
Status:
Open
For:
MadGraph5_aMC@NLO Edit question
Assignee:
No assignee Edit question
Last query:
16 hours ago
Last reply:
2018-07-13

Hi Zach,

If you have in your PYTHONPATH a directory containing the three letter UFO.
(in my laptop I use UFOMODEL)
then the auto-download of the model will use that directory instead of the local directory.

I guess that this should be enough for you, isn't it?

Cheers,

Olivier

> On 9 Jul 2018, at 16:22, Zachary Marshall <email address hidden> wrote:
>
> New question #670770 on MadGraph5_aMC@NLO:
> https://answers.launchpad.net/mg5amcnlo/+question/670770
>
> In new MadGraph versions, it's possible to download and install models that are requested that were missing. I think that's great! When we have an installation in a read-only area, though, it seems to fail. The solution would be to download the model files locally or to a .madgraph directory and then add that directory to PYTHONPATH, so that the model would be picked up by the normal infrastructure. Could such functionality be added, please?
>
> Thanks,
> Zach
>
> --
> You received this question notification because you are an answer
> contact for MadGraph5_aMC@NLO.

Hi Olivier,

That seems to me a rather dangerous solution... if I have some other software that happens to be in my path and has "UFO" in the name, MadGraph will happily start downloading models into it? Why not go with something more controlled, with a user override option? Or even a "LocalUFOInstallArea" option in the config, which we could set to "." ?

Best,
Zach

Hi,

On server, you should anyway use lmod or modules to keep your environment variable clean.
And therefore such issue should not happen.
On laptop, this is quite rare people using PYTHONPATH such that we do not really need to worry about it.
(and typically under control)

I can see two bad scenario:
- the file are put in a weird place
- the file failed to be written since the wrong place is in RO

Both are not that bad to my point of view. So this is at least not a priority.

Actually, If we want to make something more controlled, then I would skip the idea of using PYTHONPATH
since this is not really well controlled to my point of view.

Cheers,

Olivier

> On 9 Jul 2018, at 23:37, Zachary Marshall <email address hidden> wrote:
>
> Question #670770 on MadGraph5_aMC@NLO changed:
> https://answers.launchpad.net/mg5amcnlo/+question/670770
>
> Status: Answered => Open
>
> Zachary Marshall is still having a problem:
> Hi Olivier,
>
> That seems to me a rather dangerous solution... if I have some other
> software that happens to be in my path and has "UFO" in the name,
> MadGraph will happily start downloading models into it? Why not go with
> something more controlled, with a user override option? Or even a
> "LocalUFOInstallArea" option in the config, which we could set to "." ?
>
> Best,
> Zach
>
> --
> You received this question notification because you are an answer
> contact for MadGraph5_aMC@NLO.

Hi Olivier,

If the files are put in a weird place the user may literally be unable to find them, which does seem pretty bad to me (to say nothing of just writing files into some directory on the user's disk without asking first). If the files fail to be written, the job crashes, so that's not great either.

Did you document this feature anywhere? I don't see any indication in the notes that this is the behavior that was implemented (that'd be a big help!).

On the PYTHONPATH -- that is literally the mechanism by which additional python modules should be used, so this seems exactly right, not at all uncontrolled. What makes you say that using PYTHONPATH is uncontrolled? Are you imagining users have multiple directories with models, and that they won't get the right versions because their path is in the wrong order or something?

Thanks,
Zach

BTW, a proposed patch for models/import_ufo.py :

    #get target directory
    # 1. PYTHONPATH containing UFO
    # 2. Current working directory
    # 3. models directory
    target = None
    if 'PYTHONPATH' in os.environ and not local_dir:
        for directory in os.environ['PYTHONPATH'].split(':'):
            if 'UFO' in os.path.basename(directory) and os.path.exists(directory):
                target= directory
    if target is None:
        try:
            target = os.getcwd()+'/local_UFO_models'
            if not os.access(target,os.R_OK):
                os.mkdir(target)
        except Exception:
            target = pjoin(MG5DIR, 'models')

Best,
Zach

Can you help with this problem?

Provide an answer of your own, or ask Zachary Marshall for more information if necessary.

To post a message you must log in.