Skip to content
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

Translate producer-consumer from Golang to Python #95

Closed
wants to merge 1 commit into from
Closed

Conversation

anukratb
Copy link

@anukratb anukratb commented May 30, 2021

This PR focuses on translating the producer-consumer image from Golang to Python. The reason for the translation is that Golang is not natively supported by Azure Functions (they only have a work-around where you write a custom handler HTTP server that gets queried by the Azure Function). This wouldn't be a problem in itself if the serverless.com tool supported Golang deployments, but it doesn't either...

Files to be translated include:

  • producer-consumer/aws/main.go
  • producer-consumer/vhive/main.go
  • producer-consumer/common/aws.go
  • producer-consumer/common/grpc.go
  • producer-consumer/common/main.go
  • producer-consumer/common/object-storage.go
  • producer-consumer/common/util.go
  • producer-consumer/common/util-test.go

Translated python files for aws.go and util.go.
@amariucaitheodor
Copy link
Collaborator

Really good start! Please:

  • Rename the PR with a more meaningful name
  • Develop the translation into a different folder. I think we need a completely new function image dedicated to this translation, say raw-code/functions/producer-consumer-py
  • Follow the folder structure from producer-consumer, e.g., I imagine aws1.py will be producer-consumer-py/aws/common/aws.py

@amariucaitheodor
Copy link
Collaborator

Regarding your question:

When I translate GeneratePayloadFromGlobalRandom function there’s no value assigned to GlobalRandomPayload variable so when I store the value of GlobalRandomPayload variable in repeatedRandomPayload then it basically stores nothing

This is happening because GlobalRandomPayload is initialized in producer-consumer/aws/main.go, the translation of which is missing here


def AppendTimestampToChain(timestampChain):
return timestampChain.append(time.utcnow())

Copy link
Collaborator

@amariucaitheodor amariucaitheodor May 30, 2021

Choose a reason for hiding this comment

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

Please also copy the function comments, same for StringArrayToArrayOfString etc.
E.g., //StringArrayToArrayOfString will process, e.g., "[14 35 8]" into []string{14, 35, 8}

return reply["body"]["TimeStampChain"]

def AppendTimestampToChain(timestampChain):
return timestampChain.append(time.utcnow())
Copy link
Collaborator

Choose a reason for hiding this comment

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

We'll have to check if strconv.FormatInt(time.Now().UnixNano()/(int64(time.Millisecond)/int64(time.Nanosecond)), 10) is the same as time.utcnow() using unit tests later on

@amariucaitheodor amariucaitheodor linked an issue May 30, 2021 that may be closed by this pull request
8 tasks
@amariucaitheodor amariucaitheodor changed the title aws1.py and util.py Translate producer-consumer from Golang to Python Jun 4, 2021
@ustiugov ustiugov marked this pull request as draft November 19, 2021 12:06
@ustiugov
Copy link
Member

closing as it's not going to be finished

@ustiugov ustiugov closed this Oct 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Translate producer-consumer from Golang to Python
3 participants