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

fixes possible error state in nautobot_ssot_duration_seconds metric #250

Merged
merged 1 commit into from
Oct 25, 2023

Conversation

Kircheneer
Copy link
Contributor

Possibly fixes #248

@Kircheneer Kircheneer requested a review from a team as a code owner October 18, 2023 08:31
@Kircheneer Kircheneer force-pushed the fix-#248 branch 3 times, most recently from de51d28 to d1a7bf3 Compare October 18, 2023 09:03
@glennmatthews
Copy link
Contributor

Do we understand the case in which job.job_class will be None? That generally shouldn't happen, though I think it's reasonable to add error handling in the case where it does.

@Kircheneer
Copy link
Contributor Author

Do we understand the case in which job.job_class will be None? That generally shouldn't happen, though I think it's reasonable to add error handling in the case where it does.

Not quite - I want to explore this further with the user in #248 but IIRC its the second time I've seen it and I don't like the idea of breaking startup for people

@jdrew82
Copy link
Contributor

jdrew82 commented Oct 18, 2023

Do we understand the case in which job.job_class will be None? That generally shouldn't happen, though I think it's reasonable to add error handling in the case where it does.

I believe this was seen with an SSoT Job that hadn't been updated to the 2.0 pattern. Technically the Job shouldn't have loaded/functioned at all from what I saw due to this. That's why I'm hesitant to do more than a simple check for the job_class attribute existing.

@Kircheneer
Copy link
Contributor Author

I believe this was seen with an SSoT Job that hadn't been updated to the 2.0 pattern. Technically the Job shouldn't have loaded/functioned at all from what I saw due to this. That's why I'm hesitant to do more than a simple check for the job_class attribute existing.

That's all we're doing here though, isn't it?

@jdrew82
Copy link
Contributor

jdrew82 commented Oct 18, 2023

I believe this was seen with an SSoT Job that hadn't been updated to the 2.0 pattern. Technically the Job shouldn't have loaded/functioned at all from what I saw due to this. That's why I'm hesitant to do more than a simple check for the job_class attribute existing.

That's all we're doing here though, isn't it?

You appear to be doing a try/except and catching a TypeError when I'd probably use hasattr(job, "job_class") instead personally.

@Kircheneer
Copy link
Contributor Author

I believe this was seen with an SSoT Job that hadn't been updated to the 2.0 pattern. Technically the Job shouldn't have loaded/functioned at all from what I saw due to this. That's why I'm hesitant to do more than a simple check for the job_class attribute existing.

That's all we're doing here though, isn't it?

You appear to be doing a try/except and catching a TypeError when I'd probably use hasattr(job, "job_class") instead personally.

Got it, I think we can go for if job.job_class is None if you don't mind, I think that matches the core API as closely as possible. It will always have an attr as its a property

@jdrew82
Copy link
Contributor

jdrew82 commented Oct 18, 2023

I believe this was seen with an SSoT Job that hadn't been updated to the 2.0 pattern. Technically the Job shouldn't have loaded/functioned at all from what I saw due to this. That's why I'm hesitant to do more than a simple check for the job_class attribute existing.

That's all we're doing here though, isn't it?

You appear to be doing a try/except and catching a TypeError when I'd probably use hasattr(job, "job_class") instead personally.

Got it, I think we can go for if job.job_class is None if you don't mind, I think that matches the core API as closely as possible. It will always have an attr as its a property

Works for me.

@Kircheneer
Copy link
Contributor Author

Fixed!

@mzbroch
Copy link
Contributor

mzbroch commented Oct 25, 2023

FYI I pushed this (fix-#248) branch to fix248

It seems that poetry does not like # character in a branch name - it errors if referenced via git like below:

[tool.poetry.dependencies]
requests = { git = "https://github.com/kennethreitz/requests.git", branch = "next" }

Copy link
Contributor

@jdrew82 jdrew82 left a comment

Choose a reason for hiding this comment

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

LGTM!

@jdrew82 jdrew82 merged commit bc14722 into develop Oct 25, 2023
15 checks passed
@jdrew82 jdrew82 deleted the fix-#248 branch November 2, 2023 21:11
@jdrew82 jdrew82 mentioned this pull request Nov 6, 2023
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.

Error on Delete Orphaned Data Compliance Data from metrics
4 participants