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

Django q #1398

Merged
merged 102 commits into from
Apr 11, 2021
Merged

Django q #1398

merged 102 commits into from
Apr 11, 2021

Conversation

SchrodingersGat
Copy link
Member

@SchrodingersGat SchrodingersGat commented Mar 11, 2021

@SchrodingersGat SchrodingersGat self-assigned this Mar 11, 2021
@SchrodingersGat SchrodingersGat added the enhancement This is an suggested enhancement or new feature label Mar 11, 2021
return [int(g) for g in match.groups()]


def versionTupleToInt(version):
Copy link
Contributor

Choose a reason for hiding this comment

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

You can compare version tuples directly.

(2,4,1) < (2,4,2): True
(3) > (2,4,2): True

Copy link
Member Author

Choose a reason for hiding this comment

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

Huh, you learn something new every day. I did not know Python could do that!

now = datetime.now()
past = now - timedelta(minutes=10)

results = Success.objects.filter(
Copy link
Contributor

Choose a reason for hiding this comment

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

I would just delete any heart beat other than the last one while I'm in this code.


clusters = Stat.get_all()

if len(clusters) > 0:
Copy link
Contributor

@rcludwick rcludwick Mar 14, 2021

Choose a reason for hiding this comment

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

if clusters:
return True

Since it's more pythonic.

Or if stat.get_all(): return True

}

all_healthy = True

for k in status.keys():
Copy link
Contributor

@rcludwick rcludwick Mar 16, 2021

Choose a reason for hiding this comment

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

all_healthy = all([v for v in status.values()])

@rcludwick
Copy link
Contributor

I tend to say yes for simplicity with dealing with the media/statics, but you could also just make life easier for yourself and just provide a configuration for a docker-compose with nginx sitting in front of it.

@SchrodingersGat
Copy link
Member Author

@rcludwick I think this is ready for a test drive now. Please let me know if you can get it working on your end, and if there's anything else I should add, before it goes live on dockerhub

@SchrodingersGat SchrodingersGat merged commit a2ff3e3 into inventree:master Apr 11, 2021
@SchrodingersGat SchrodingersGat deleted the django-q branch April 11, 2021 05:38
@rcludwick
Copy link
Contributor

Apologies, I didn't get a chance this weekend to look at it this weekend. I can't wait to try it out on my "production" server at home.

If I see anything wrong, I'll just file issues/PR's.

🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This is an suggested enhancement or new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Investigate implementation of "background tasks"
2 participants