Giter VIP home page Giter VIP logo

Comments (2)

bockp avatar bockp commented on June 5, 2024

After some digging, I find that commenting these lines in /waves/wcore/views/files.py returns the expected functionality, letting me access all the results files and logs through the web interface again:

        assert isinstance(self.object, ExportAbleMixin),' Model object must be Export-able'
        self.object.serialize()

These lines seem linked to the ExportAbleMixin class that is imported from /waves/wcore/base.py

class ExportAbleMixin(object):
    """ Some models object may be 'exportable' in order to be imported elsewhere in another WAVES app.
    Based on Django serializer, because we don't want to select fields to export
    """

    def serializer(self, context=None):
        """ Each sub class must implement this method to initialize its Serializer"""
        raise NotImplementedError('Sub classes must implements this method')

    def serialize(self):
        """ Import model object serializer, serialize and write data to disk """
        from os.path import join
        from waves.wcore.settings import waves_settings
        import json
        file_path = join(waves_settings.DATA_ROOT, self.export_file_name)
        with open(file_path, 'w') as fp:
            try:
                serializer = self.serializer()
                data = serializer.to_representation(self)
                fp.write(json.dumps(data, indent=2))
                return file_path
            except Exception as e:
                raise ExportError('Error dumping model {} [{}]'.format(self, e))

    @property
    def export_file_name(self):
        """ Create export file name, based on concrete class name"""
        return '{}_{}.json'.format(self.__class__.__name__.lower(), str(self.pk))

I have yet to figure out exactly why this is posing a problem, but it would seem the objects (be they text files, csv, tsv, png or .zip. All cases in my pipeline that were broken but now work without these commented lines) can't be serialized, and that was what caused the errors.

In any case, commenting the above lines serves as a fix to this problem.
(probably a temporary fix, as there must be a reason why the objects need to be serialized, and just removing the check might break something else).

from waves-core.

marcoooo avatar marcoooo commented on June 5, 2024

Fixed from 1.6.6

from waves-core.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.