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

Add skip_wait_on_job_termination option for dataflow job resources #10728

Closed

Conversation

n-oden
Copy link

@n-oden n-oden commented Dec 10, 2021

@n-oden
Copy link
Author

n-oden commented Jan 3, 2022

@ScottSuarez Happy new year! Did you have any thoughts on this one?

@ScottSuarez
Copy link
Collaborator

I think I understand the use case but could you elaborate or go into more detail on your change?

@n-oden
Copy link
Author

n-oden commented Jan 5, 2022

@ScottSuarez #10559 goes into a lot more detail; the 5s summary is "sometimes draining streaming dataflow jobs takes a ridiculously long time" -- minutes to hours depending on what sort of internal windowing/watermark strategy your job is using. This means that potentially your terraform workspace is locked for that entire time while waiting for the job to drain.

With this in place, operators will have the option of waiting only until the job reaches the DRAINING state before moving on. Obviously this has the caveat that if you try to create a replacement job with the same name before the job actually exits it will fail, hence the digression about random_id in the doc examples.

@ScottSuarez ScottSuarez requested review from rileykarson and removed request for ScottSuarez January 5, 2022 20:12
@n-oden
Copy link
Author

n-oden commented Jan 14, 2022

@rileykarson happy new year! Thoughts on this?

@n-oden
Copy link
Author

n-oden commented Mar 13, 2022

@ScottSuarez @rileykarson nudge? If this isn't an approach to #10559 that you like, please let me know.

@ScottSuarez ScottSuarez requested review from ScottSuarez and removed request for rileykarson March 15, 2022 22:55
@ScottSuarez
Copy link
Collaborator

taking over review here. I'll give this a look over soon

Copy link
Collaborator

@ScottSuarez ScottSuarez left a comment

Choose a reason for hiding this comment

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

Could you also add a test case to the testsuite for this resource and ensure it passes

https://github.com/hashicorp/terraform-provider-google/blob/main/google/resource_dataflow_job_test.go

Comment on lines +481 to +485
if !ok {
if d.Get("skip_wait_on_job_termination").(bool) {
_, ok = dataflowTerminatingStatesMap[d.Get("state").(string)]
}
}
Copy link
Collaborator

@ScottSuarez ScottSuarez Mar 18, 2022

Choose a reason for hiding this comment

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

This logic is repeated several times. Can you extrapolate this to a function

func shouldStopDataflowJobDeleteQuery(state string, skipWait bool) bool {
	_, stopQuery := dataflowTerminalStatesMap[state]
	if !stopQuery && skipWait {
		_, stopQuery = dataflowTerminatingStatesMap[d.Get("state").(string)]
	}
	return stopQuery
}

@n-oden
Copy link
Author

n-oden commented Mar 18, 2022

All reasonable requests! I'll try to get it sorted out both here and in the beta-provider PR on monday or tuesday.

@ScottSuarez
Copy link
Collaborator

ScottSuarez commented Mar 18, 2022

Can you make the changes against the upstream repository https://github.com/GoogleCloudPlatform/magic-modules

We use this to generate the two versions of the provider. Tag me on the PR when you open it

@n-oden
Copy link
Author

n-oden commented Mar 22, 2022

continued in GoogleCloudPlatform/magic-modules#5844

@n-oden n-oden closed this Mar 22, 2022
@n-oden n-oden deleted the add-dataflow-job-skip-wait-option branch March 22, 2022 17:44
@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants