question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`self.perf_patterns` as a dictionary

See original GitHub issue

Hi, I would like to run the osu-micro-benchmark from size 1 to 4194304 in a single run.

To get the performance metric I am using:

    @run_before("performance")
    def set_perf_patterns(self):
        regex = r"^(?P<size>\d+)\s+(?P<perf>\S+)"
        sizes = sn.extractall(regex, self.stdout, "size", int)
        perfs = sn.extractall(regex, self.stdout, "perf", float)
        self.perf_patterns = dict(zip(sizes, perfs))

But reFrame errors as the dictionary keys are not hashable. Is there a better way to defer this operation?

Thanks

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jjoterocommented, Aug 19, 2021

Hi @yellowhat ! I can see a few things that could help here.

  1. Hooks do not run in the test’s stage directory (the reason is that one could have a pre-setup hook, which runs before the stage directory has even been created). You have to manually change the directory. You can do that with the osext module under utility.
  2. The sn.extractall builds a deferrable expression (i.e. it captures the arguments passed to the function and it does not evaluate the actual function until you call sn.evaluate on the returning object). The return object is not hashable, so you can’t use it as keys in any kind of dictionary.
@run_before('performance')
def set_perf_patterns(self):
    with osext.change_dir(self.stagedir):
        ...
        sizes = sn.evaluate(sn.extractall(regex, self.stdout, "size", int))
        ...
0reactions
jjoterocommented, Aug 19, 2021
Read more comments on GitHub >

github_iconTop Results From Across the Web

Self-perpetuating Definition & Meaning - Dictionary.com
Self -perpetuating definition, continuing oneself in office, rank, etc., beyond the normal limit. See more.
Read more >
Self-perpetuating Definition & Meaning - Merriam-Webster
The meaning of SELF-PERPETUATING is capable of continuing or renewing oneself indefinitely : capable of perpetuating oneself or itself.
Read more >
how to pass self to function inside python dictionary
I'm trying to store a function in python dictionary that minipulates some ranges from the dictionary it self, but I don't how to...
Read more >
Get a dictionary from an Objects Fields - GeeksforGeeks
In this article, we will discuss how to get a dictionary from object's field i.e. how to get the class members in the...
Read more >
Create a Dictionary in Python – Python Dict Methods
You will learn how to create dictionaries, access the elements inside them, and how to modify them depending on your needs.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found