Skip to content

Early client impl and docs scaffolding #6

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 11 commits into from
Feb 16, 2022
Merged

Conversation

cretz
Copy link
Member

@cretz cretz commented Feb 7, 2022

What was changed

  • Added client impl
    • Supporting new core approach
    • TLS, worker binary ID, etc
  • Added docs scaffolding
  • Exceptions
  • Tests

@cretz cretz marked this pull request as draft February 7, 2022 16:13
return next


class OutboundInterceptor:
Copy link
Member

Choose a reason for hiding this comment

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

Maybe call this BaseOutboundInterceptor?

Copy link
Member Author

Choose a reason for hiding this comment

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

I am not sure it has value anymore than a suggestion to call it BaseTemporalError would. While some Python classes do this, it's by no means universal (it's not BaseIntEnum or BaseTypedDict).

Also, I am intentionally allowing this to be instantiated directly (this will be especially true with classes temporalio.worker.WorkflowOutboundInterceptor) for the default implementation. I intentionally do not make these @abstractmethod or extend ABC for that reason.

Copy link
Member

Choose a reason for hiding this comment

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

I'm fine with the naming, not sure why we need to allow direct instantiation though for the outbound interceptor though.

Copy link
Member Author

Choose a reason for hiding this comment

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

Usually when subclassing you don't have to, but if people wanted to use composition instead they'd want to. Being able to make a "default interceptor" could have benefits in a ternary, e.g. interceptor = my_interceptor or OutboundInterceptor. Otherwise, it's just general decent practice to not force something to be abstract/base that has no implementation requirements.

Copy link
Member

Choose a reason for hiding this comment

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

I don't see much value in having an empty interceptor in the chain TBH but with the inheritance based approach I can see why you'd want to allow this.

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't see much value in it either. I just don't like making something abstract unnecessarily. I would just as soon call this DefaultOutboundInterceptor.

@cretz cretz marked this pull request as ready for review February 14, 2022 17:18
return next


class OutboundInterceptor:
Copy link
Member

Choose a reason for hiding this comment

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

I don't see much value in having an empty interceptor in the chain TBH but with the inheritance based approach I can see why you'd want to allow this.

pass


class FailureError(TemporalError):
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm fine with FailureError or TemporalFailureError. Prefer them over ServiceError because of the ApplicationError dissonance.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah that's fair. TemporalFailureError is a bit of a mouthful but maybe the most understandable

Copy link
Member Author

Choose a reason for hiding this comment

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

It's in the temporalio namespace and I prefer not to stutter (people more often qualify their references in Python than Typescript). I only prefixed Temporal as the root error.

@cretz
Copy link
Member Author

cretz commented Feb 16, 2022

Enough consensus reached, merging.

@cretz cretz merged commit 2afda4e into temporalio:main Feb 16, 2022
@cretz cretz deleted the client-impl branch February 16, 2022 14:18
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.

4 participants