numbbo / coco

Numerical Black-Box Optimization Benchmarking Framework
https://numbbo.github.io/coco
Other
261 stars 87 forks source link

Postprocessing in IPython from different folders has big problems #1512

Closed brockho closed 7 years ago

brockho commented 7 years ago

As a follow-up of the discussion at #1507, I here report more details about the bug, I observed (happens in the current development branch):

The general issue is that postprocessing two algorithms from different folders causes quite a lot of unwanted behavior from the IPython shell:

In [6]: cocopp.main('-o ppdata-clean-pathfiwthdots SMS-EMOA-SA.tgz ../../2016/coco
   ...: -2.0-hvrefsets/SMS-EMOA-DE.tgz')

Post-processing (2+): will generate output data in folder ppdata-clean-pathfiwthdots
  this might take several minutes.
  Data consistent according to consistency_check() in pproc.DataSet
  using: .\SMS-EMOA-SA.tgz
---------------------------------------------------------------------------
IOError                                   Traceback (most recent call last)
<ipython-input-6-860f5cb83d46> in <module>()
----> 1 cocopp.main('-o ppdata-clean-pathfiwthdots SMS-EMOA-SA.tgz ../../2016/coco-2.0-hvrefsets/SMS
-EMOA-DE.tgz')

C:\Users\dimo\AppData\Roaming\Python\Python27\site-packages\cocopp-2.0.531-py2.7.egg\cocopp\rungener
ic.pyc in main(argv)
    268
    269         if len(args) >= 2 or len(genericsettings.background) > 0:
--> 270             dsld = rungenericmany.main(genopts + ["-o", outputdir] + args)
    271             toolsdivers.prepend_to_file(latex_commands_filename,
    272                                         ['\\providecommand{\\numofalgs}{2+}']

C:\Users\dimo\AppData\Roaming\Python\Python27\site-packages\cocopp-2.0.531-py2.7.egg\cocopp\rungener
icmany.pyc in main(argv)
    278                         )
    279
--> 280         dsList, sortedAlgs, dictAlg = processInputArgs(args, True)
    281
    282         if not dsList:

C:\Users\dimo\AppData\Roaming\Python\Python27\site-packages\cocopp-2.0.531-py2.7.egg\cocopp\pproc.py
c in processInputArgs(args, process_background_algorithms)
   2627     dictAlg = {}
   2628     current_hash = None
-> 2629     process_arguments(args, current_hash, dictAlg, dsList, sortedAlgs)
   2630     if process_background_algorithms:
   2631         genericsettings.foreground_algorithm_list.extend(sortedAlgs)

C:\Users\dimo\AppData\Roaming\Python\Python27\site-packages\cocopp-2.0.531-py2.7.egg\cocopp\pproc.py
c in process_arguments(args, current_hash, dictAlg, dsList, sortedAlgs)
   2644             continue
   2645         if findfiles.is_recognized_repository_filetype(i):
-> 2646             filelist = findfiles.main(i)
   2647             # Do here any sorting or filtering necessary.
   2648             # filelist = list(i for i in filelist if i.count('ppdata_f005'))

C:\Users\dimo\AppData\Roaming\Python\Python27\site-packages\cocopp-2.0.531-py2.7.egg\cocopp\findfile
s.pyc in main(directory)
     40     file_list = list()
     41     root = ''
---> 42     directory = get_directory(directory, True)
     43
     44     # Search through the directory directory and all its subfolders.

C:\Users\dimo\AppData\Roaming\Python\Python27\site-packages\cocopp-2.0.531-py2.7.egg\cocopp\findfile
s.pyc in get_directory(directory, extract_files)
     75         if extract_files:
     76             if (not os.path.exists(dir_name)) or (os.path.getmtime(dir_name) < os.path.getmt
ime(directory)):
---> 77                 tar_file = tarfile.TarFile.open(directory)
     78                 longest_file_length = max(len(i) for i in tar_file.getnames())
     79                 if ('win32' in sys.platform) and len(dir_name) + longest_file_length > 259:

c:\users\dimo\anaconda2\lib\tarfile.pyc in open(cls, name, mode, fileobj, bufsize, **kwargs)
   1673                     saved_pos = fileobj.tell()
   1674                 try:
-> 1675                     return func(name, "r", fileobj, **kwargs)
   1676                 except (ReadError, CompressionError), e:
   1677                     if fileobj is not None:

c:\users\dimo\anaconda2\lib\tarfile.pyc in gzopen(cls, name, mode, fileobj, compresslevel, **kwargs)

   1738
   1739         try:
-> 1740             fileobj = gzip.GzipFile(name, mode, compresslevel, fileobj)
   1741         except OSError:
   1742             if fileobj is not None and mode == 'r':

c:\users\dimo\anaconda2\lib\gzip.pyc in __init__(self, filename, mode, compresslevel, fileobj, mtime
)
     92             mode += 'b'
     93         if fileobj is None:
---> 94             fileobj = self.myfileobj = __builtin__.open(filename, mode or 'rb')
     95         if filename is None:
     96             # Issue #13781: os.fdopen() creates a fileobj with a bogus name

IOError: [Errno 2] No such file or directory: '.\\../../2016/coco-2.0-hvrefsets/SMS-EMOA-DE.tgz'

In [7]:

I can only imagine that both have to have something to do with the relative paths in the cocopp.main call. But it could also be related to too long paths as in #673, but I expected that at least a warning is issued in this case.

nikohansen commented 7 years ago

Could it be that this only happens when multi-objective data are readin/processed?

brockho commented 7 years ago

The first issue also appears for single-objective data sets, for example, when running `cocopp.main('-o ppdata-I ALPS_hornby_noiseless.tgz ../../2010/rawdata/1plus1_brockhoff_noiseless.tar.gz').

The second problem seems to come from issue #1499, in other words, if I set cocopp.genericsettings.foreground_algorithm_list = [] in between two calls the above error is not produced anymore (but still does not show the correct index.html file). Note that I have not tested with the latest code due to the bug introduced yesterday that crashed the postprocessing tests.

brockho commented 7 years ago

Last time, we discussed this issue, we realized that files are written directly to the ppdata folder and not into a subfolder with the names of the algorithms when the data comes from different folders.

brockho commented 7 years ago

This issue is, as well, solved by the small change in e004a88.