Git Product home page Git Product logo

Comments (3)

pabloem avatar pabloem commented on July 20, 2024

I'm a bit stuck on this. Here's the issue:
It would make sense to have an enum for job types, but our data exchange format is JSON. Since we want to serialize all this data to be able to recover in case the workers or the master are killed, we will be writing a bunch of JSON to hard drive - and I figured it would be nice if it was human-readable. Does this make sense?

Now let me elaborate with JSON-design issues:

Actually, I am not sure what JSON library to use. I looked at GSON and Jackson but I don't like that they lack some flexibility (what if a job has more attributes than just those defined in a class?), so I'm using json-minimal like you guys do in Cineast.

By using JsonObject as the internal representation, we end up with something that is easy to serialize, but it is a bit awkward at times (see the new Job class' getter methods).

If we used a JSON-POJO library it would make serialization easy and coding less awkward, but we might lose flexibility. What's your take on this?

P.S.: Sorry for the clumsy writing. I was on a rush. : ) Let me know if there are any problems.

from cthulhu.

lucaro avatar lucaro commented on July 20, 2024

I wouldn't use jsonobjects as internal storage objects but rather build a static serialize and deserialize method. The serialize function transform a job object into a json-encoded string while the deserialize method would be a factory creating job-objects from json-strings. I don't really see an issue with using an existing library like GSON or Jackson to do this...

The primary reason why cineast uses json-minimal was that it was easy to extend the parser in order to add an additional stop symbol ';' so it would return when reading from a stream without the stream having to be closed. I also quite like the API...

from cthulhu.

pabloem avatar pabloem commented on July 20, 2024

Alright! I've switched to GSON for Job creation. I solved the 'flexibility' problem by creating a custom serializer/deserializer so that each job type can be serialized/deserialized properly. Job type will take the name of the classes (e.g. "BashJob", "FeatureExtractionJob", "Job", etc.)

from cthulhu.

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.