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

Logging for SmartRedis #281

Merged
merged 41 commits into from
Dec 14, 2022
Merged

Conversation

billschereriii
Copy link
Contributor

No description provided.

@billschereriii billschereriii added type: feature Issues that include feature request or feature idea area: docs Issues related to documentation area: test Issues related to the test suite area: python Issues related to the Python Client area: C++ Issues related to the C++ client area: C Issues related to the C client area: fortran issues related to the Fortran Client API break Issues that include incompatible API changes labels Nov 16, 2022
@billschereriii billschereriii self-assigned this Nov 16, 2022
@billschereriii
Copy link
Contributor Author

Initial C++ implementation is code complete, but not tested (or even compiled!). Provided for team review of implementation direction only

Copy link
Collaborator

@mellis13 mellis13 left a comment

Choose a reason for hiding this comment

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

Thanks for this draft PR! I did a high level review and just had a couple of comments/questions. I can do a more detailed review when it is done.

@billschereriii billschereriii marked this pull request as ready for review November 29, 2022 22:56
Copy link
Collaborator

@ashao ashao left a comment

Choose a reason for hiding this comment

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

Really great implementation and you did a great job keeping it very compact. I really appreciate the refactor to isolate the places where we get the values of configuration variables.

The largest comment/criticism that I have is that the logging is quite closely tied to the Client. As we've discussed offline, this might interfere with multiple client support down the line, but after reviewing this PR there's a larger question about how the logging interacts with various entities within SmartRedis. My suggestion is that we pass in the SmartRedis object that we're trying to log and that the identifier that appears in the logging file is extracted from the object. For example:

log_message(dataset, "Corralling llamas")
log_message(client, "Reticulating splines")

with the resulting logfile saying
dataset-1: Corralling llamas
client-foo: Reticulating splines

In this way, the Client, Dataset, and Logger are all first-class entities (which interact with each other) whereas now the Logger is somewhat subordinate to Client. This can be seen most clearly in the Dataset constructor which allows you to set a client id. Happy to talk about this in greater detail.

UPDATE:
After talking with Bill, my mental model of the above is incorrect, arising from my assumption that client_id referenced in the logger was directly tied to our SmartRedis client. Changing that from client_id to logger_id makes it easier to distinguish.

Another question to be discussed: Should we have the logger put the name of the Dataset or Client in the logging file.

Copy link
Collaborator

@mellis13 mellis13 left a comment

Choose a reason for hiding this comment

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

Great PR! This is a huge step in the right direction for the code. I had similar general questions as Andrew regarding code structure, but won't repeat here. I'd be happy to join follow-up design discussions.

Just as a final note, we should run the scaling tests before merging to make sure there is no perf hit.

Copy link
Member

@MattToast MattToast left a comment

Choose a reason for hiding this comment

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

PR looks amazing!! I took a look mostly at the python side of things to make sure my feedback was documented were it was most useful. I have a couple of things I wanted to confirm but otherwise looks fantastic!

I'll circle back around tomorrow to look over the rest of it in more detail tomorrow, but scanning over Andrew and Matt's feedback it looks like they have already commented on, and you have addressed, most of my concerns

Copy link
Member

@MattToast MattToast left a comment

Choose a reason for hiding this comment

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

A couple of small requests that I have after parsing some of the logs from the scaling study.

Copy link
Collaborator

@mellis13 mellis13 left a comment

Choose a reason for hiding this comment

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

Thanks for working so hard on this logging functionality! Just one small comment/question. Otherwise LGTM

#include "srexception.h"
#include "logger.h"
//#include "srobject.h"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there a reason these comments were left?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll clean this up as part of ticket #338. It doesn't really hurt anything before then.

Copy link
Collaborator

@ashao ashao left a comment

Choose a reason for hiding this comment

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

Thanks for all the extra work on this PR. This logging functionality is a huge quality of life and productivity boost for application developers.

Copy link
Member

@MattToast MattToast left a comment

Choose a reason for hiding this comment

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

LGTM!! Couple of last minute recommendations for the python side of things, but overall everything looks fantastic! Thanks for the hard work on this one!!

from .smartredisPy import PyLogContext
from .util import exception_handler, typecheck

from .error import *
Copy link
Member

Choose a reason for hiding this comment

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

Nothing from error is used

from .smartredisPy import PySRObject
from .util import exception_handler, typecheck

from .error import *
Copy link
Member

Choose a reason for hiding this comment

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

Nothing from error used

:type name: str
"""
typecheck(context, "context", str)
self._name = context
Copy link
Member

Choose a reason for hiding this comment

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

Storing the ctx in a "protected" variable, but doesn't seem to be used internally within the class. Could be problematic if an app dev were to instance and then call set_data. Maybe remove or replace with

@property
@exception_handler
def name(self):
    # Note: This would require adding new bindings
    self._data.get().get_context()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Object-based context in Python isn't working yet, but will be resolved shortly as part of #338

:type name: str
"""
typecheck(context, "context", str)
self._name = context
Copy link
Member

Choose a reason for hiding this comment

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

Similar ctx is stored in a "protected" member and not used internally as noted on the python SRObject class. Maybe remove or make a property?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Object-based context in Python isn't working yet, but will be resolved shortly as part of #338

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But the property approach looks completely viable

@billschereriii billschereriii merged commit bb11d08 into CrayLabs:develop Dec 14, 2022
@billschereriii billschereriii deleted the lager branch December 14, 2022 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API break Issues that include incompatible API changes area: C++ Issues related to the C++ client area: C Issues related to the C client area: docs Issues related to documentation area: fortran issues related to the Fortran Client area: python Issues related to the Python Client area: test Issues related to the test suite type: feature Issues that include feature request or feature idea
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants