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

Allow an on_update as well as a _RecordUpdater #121

Open
evalott100 opened this issue Jun 13, 2024 · 1 comment
Open

Allow an on_update as well as a _RecordUpdater #121

evalott100 opened this issue Jun 13, 2024 · 1 comment

Comments

@evalott100
Copy link
Contributor

In

record_updater = None
if (
"on_update" not in kwargs
and "on_update_name" not in kwargs
and record_creation_func in OUT_RECORD_FUNCTIONS
):
record_updater = _RecordUpdater(
record_info,
self._record_prefix,
self._client,
self._all_values_dict,
labels if labels else None,
)
extra_kwargs["on_update"] = record_updater.update
extra_kwargs["DESC"] = trim_description(description, record_name)
record = record_creation_func(
record_name, *labels, *args, **extra_kwargs, **kwargs
)

A record updater is created to send data back to the panda.

  • Nowhere in the code passes on_update_name so this should be removed.
  • We should allow for the passing of a seperate argument record_updater, which can be merged with the passed in on_update.
  • We should allow for records with their own on_update which aren't _RecordUpdater.updates to also be given a _RecordUpdater.
@AlexanderWells-diamond
Copy link
Contributor

Nowhere in the code passes on_update_name so this should be removed.

I added that as defensive code in case we ever do use it. If someone were to use it they would likely have an unexpected result, as the code would break in an unrelated place. I'm ok with removing it as long as this sort of protection is still available; if we change how the RecordUpdater is created/passed that will probably handle it.

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

No branches or pull requests

2 participants