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

Added 'workgroup' as optional argument to athena component #3254

Merged

Conversation

LeonardAukea
Copy link
Contributor

@LeonardAukea LeonardAukea commented Mar 10, 2020

@Jeffwan Not sure if you want this here. But at least we needed this option. If you want me to commit more changes etc. I can do that too. I noticed that you had some todos.


This change is Reviewable

@k8s-ci-robot
Copy link
Contributor

Hi @LeonardAukea. Thanks for your PR.

I'm waiting for a kubeflow member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@LeonardAukea
Copy link
Contributor Author

/assign @Jeffwan

@Jeffwan
Copy link
Member

Jeffwan commented Mar 10, 2020

Thanks for the contribution!

)
def query(client, query, database, output, workgroup=None):

if workgroup:
Copy link
Member

Choose a reason for hiding this comment

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

Is there more elegant way to handle optional arguments here? If we have extra configs, we will have lots of if else and nested if else logic here.

Copy link
Contributor Author

@LeonardAukea LeonardAukea Mar 10, 2020

Choose a reason for hiding this comment

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

Yeah, sorry about that @Jeffwan. The camelcase args are not super elegant either (boto3).
I can change it to:

arg_dict = dict(QueryString=query,
        QueryExecutionContext={
            'Database': database
            },
        ResultConfiguration={
            'OutputLocation': output,
            }
        )
if workgroup:
      arg_dict.update(dict(WorkGroup=workgroup))

response = client.start_query_execution(**arg_dict)

Unless you have a better option?

Copy link
Contributor Author

@LeonardAukea LeonardAukea Mar 10, 2020

Choose a reason for hiding this comment

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

I accidentally added black formatting in the latest commit. Sorry in advance, if the changes are not as clear. But it's essentially the above. Except arg_dict is renamed to params

@LeonardAukea
Copy link
Contributor Author

@Jeffwan If more AWS components are of interest to you guys. We could potentially add more. eg. S3 interactions. Since, we are writing them anyways. It's not too much of a hassle to make them a little neater and general enough. Are you planning to provide a set of "official" AWS reusable components?

QueryExecutionContext={"Database": database},
ResultConfiguration={"OutputLocation": output,},
)
if workgroup:
Copy link
Member

Choose a reason for hiding this comment

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

Thanks. This looks better.

@Jeffwan
Copy link
Member

Jeffwan commented Mar 11, 2020

/ok-to-test

@Jeffwan
Copy link
Member

Jeffwan commented Mar 11, 2020

@Jeffwan If more AWS components are of interest to you guys. We could potentially add more. eg. S3 interactions. Since, we are writing them anyways. It's not too much of a hassle to make them a little neater and general enough. Are you planning to provide a set of "official" AWS reusable components?

That would be great. Could you create an issue and share the plans of components you like to add? Yes, managed services components are something we'd like to add and maintain. Current focus is more on the data plane and ML area.

@Jeffwan
Copy link
Member

Jeffwan commented Mar 11, 2020

/lgtm

@mameshini
Copy link

/lgtm

@mameshini
Copy link

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mameshini

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot merged commit a3defb1 into kubeflow:master Mar 13, 2020
Jeffwan pushed a commit to Jeffwan/pipelines that referenced this pull request Dec 9, 2020
…3254)

* added optional workgroup arg

* Added a slighly more elegant way of handling query exec params

* added args to yml and main()

* added args to yml and main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants