10000 introduce modes for required ordered serialization by fwbrasil · Pull Request #1757 · twitter/scalding · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

introduce modes for required ordered serialization #1757

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 15, 2017

Conversation

fwbrasil
Copy link
Contributor

Problem

We're planning to roll out OrderedSerialization to more jobs. The initial plan was to add the RequiredBinaryComparators traits to our execution and job classes, but jobs could fail at runtime if TypedPipe transformations are done outside the job/execution body since the implicit macro wouldn't be available. For instance, we recommend people to extract transformations in companion objects for testability.

Solution

Introduce a mechanism that allows us to add the traits without failing at runtime if a transformation doesn't have the ordered serialization. By overriding requireOrderedSerializationMode, we can set the mode to Log, which will produce an error message at runtime.

Notes

  • I've enhanced the error message so users know how to fix the problem without having to ask us or look at the FAQ
  • I"ve kept backward compatibility, but I'm not sure if it's necessary

@fwbrasil
Copy link
Contributor Author

cc/ @johnynek

8000

Copy link
Collaborator
@johnynek johnynek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some minor nits. Take or leave them.


import org.scalatest.{ Matchers, WordSpec }

class NoOrderdSerJob(args: Args) extends Job(args) {
class NoOrderdSerJob(args: Args, mode: String) extends Job(args) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mode is confusing here since it is almost always scalding.Mode named that. Can we rename?

case RequireOrderedSerializationMode.Fail =>
Failure(new RuntimeException(message))
case RequireOrderedSerializationMode.Log =>
LOG.error(message)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be an error or warning? I kind of feel warning.

@fwbrasil
Copy link
Contributor Author
fwbrasil commented Dec 14, 2017

@johnynek I've just addressed your comments. Thank you for the quick review!

@johnynek
Copy link
Collaborator

👍

trait RequiredBinaryComparatorsConfig extends Job {
override def config = super.config + (Config.ScaldingRequireOrderedSerialization -> "true")
def requireOrderedSerializationMode: RequireOrderedSerializationMode = RequireOrderedSerializationMode.Fail
override def config = super.config + (Config.ScaldingRequireOrderedSerialization -> requireOrderedSerializationMode.toString)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the .toString supposed to output here? Aren't we matching on lowercase in getRequireOrderedSerializationMode above?

@johnynek johnynek merged commit 0df1c92 into twitter:develop Dec 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0