Skip to content

Conversation

@romibuzi
Copy link
Contributor

Closes: #29960

@boring-cyborg boring-cyborg bot added area:providers provider:amazon AWS/Amazon - related issues labels Mar 17, 2023
return self.get_conn().start_job_run(JobName=job_name, Arguments=script_arguments, **run_kwargs)
if self.update_config:
self.create_or_update_glue_job()
return self.get_conn().start_job_run(
Copy link
Contributor

@ferruzzi ferruzzi Mar 20, 2023

Choose a reason for hiding this comment

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

Small non-blocking nitpick, if you'd be so kind. We are trying to encourage using the self.conn cached property over the self.get_conn() getter method. If you are so inclined, could you make that change here and in the relevant test below?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hey @ferruzzi, sure I can change it and also other occurences in the file 👍

Comment on lines 168 to 170
if self.update_config:
self.create_or_update_glue_job()
return self.get_conn().start_job_run(
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the fast turnaround!

I don't think this quite matches the behaviour before your config update changes. Previously the code would check for an existing job with that name and then start it OR it would create the job if it didn't find an existing one, and then start that one. In this PR it seems if update_config is False (the default) we go straight to starting the job without first creating it if it doesn't exit (but I may be missing something).
I think you want something like:

try:
    if self.update_config:
        job_name = self.create_or_update_glue_job()
    else:
        job_name = self.get_or_create_glue_job()

    return glue_client.start_job_run(JobName=job_name, Arguments=script_arguments, **run_kwargs)

except Exception as general_error:
    self.log.error("Failed to run aws glue job, error: %s", general_error)
    raise

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hey @o-nikolas, oh nice catch indeed. this is exactly what the code was doing before, I am gonna change it

@potiuk potiuk merged commit 46d9a0c into apache:main Mar 21, 2023
@romibuzi romibuzi deleted the fix/29960-glue-operator-optional-update-config branch March 23, 2023 08:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:providers provider:amazon AWS/Amazon - related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GlueJobOperator failing with Invalid type for parameter RoleName after updating provider version.

4 participants