FREVA-CLINT / freva

The Free Evaluation System Framework (FreVa)
Other
10 stars 3 forks source link

error retrieving configuration from history with Range parameter #132

Closed eelucio closed 1 year ago

eelucio commented 1 year ago

If a plugin (e.g. leadtimeselektor) uses Range ParameterType, when trying to retrieve the configuration from a particular Job ID we would get an error. E.g.:

$ module load clint xces
$ freva history --entry-ids 924179 --full-text
924179) leadtimeselect(1, 1, 3) d396d82a88306bbbd6262a81dbade935ea651d0d [2023-07-06 14:08:18] finished 
Configuration:
          cache=/work/bm1159/XCES/xces-work/k204229/evaluation_system/output/leadtimeselect
     cacheclear=False
       decadals=1960,1961,1962
         dryrun=True
       ensemble=r10i2p1,r12i2p1
     experiment=dkfen4
      institute=mpi
          model=mpi-esm-lr
         months=None
    observation=None
         output=/work/bm1159/XCES/xces-work/k204229/evaluation_system/output/leadtimeselect
        product=decadal
        project=user-b380001
 time_frequency=mon
       variable=tas

$ freva history --entry-ids 924179 --return-command
Traceback (most recent call last):
  File "/home/b/b380001/freva/bin/freva", line 8, in <module>
    sys.exit(main())
  File "/home/b/b380001/freva/lib/python3.10/site-packages/freva/cli/__init__.py", line 50, in main
    ArgParser(argv or sys.argv[1:])
  File "/home/b/b380001/freva/lib/python3.10/site-packages/freva/cli/__init__.py", line 42, in __init__
    args.apply_func(args, **self.kwargs)
  File "/home/b/b380001/freva/lib/python3.10/site-packages/freva/cli/history.py", line 95, in run_cmd
    commands = freva.history(_return_dict=False, **kwargs)
  File "/home/b/b380001/freva/lib/python3.10/site-packages/freva/_history.py", line 105, in history
    cmd = pm.get_command_string_from_row(row)
  File "/home/b/b380001/freva/lib/python3.10/site-packages/evaluation_system/api/plugin_manager.py", line 1102, in get_command_string_from_row
    return get_command_string_from_config(config)
  File "/home/b/b380001/freva/lib/python3.10/site-packages/evaluation_system/api/plugin_manager.py", line 1072, in get_command_string_from_config
    result.append(f"{key}={','.join(value)}")
TypeError: sequence item 0: expected str instance, int found

Is pointing here: https://github.com/FREVA-CLINT/freva/blob/e1f6e48cb63e841614bc7975f268234d064475cf/src/evaluation_system/api/plugin_manager.py#L1072

antarcticrainforest commented 1 year ago

Ok I'll have a look at this later this week. I think this might just be a representation issue with the command reconstruction.