Skip to content

how to print on terminal the values found with reframe.utility.sanity.extractall #1001

@smarocchi

Description

@smarocchi

Hello,
I am starting to write regression tests with ReFrame, I am using the sanity functions for extracting values. In particular

   found_measures=reframe.utility.sanity.extractall(
        r'write\s+([\d\.]+)\s+([\d\.]+)\s+([\d\.]+)\s+([\d\.]+)\s+([\d\.]+)\s+([\d\.]+)\s+([\d\.]+)\s+([\d\.]+)\s+([\d\.]+)\s+(\w+)\s+(\w+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+([\d\.]+)\s+(\w+)\s+(\d+)', self.stdout)

to match the lines in the output

Summary of all tests:
Operation   Max(MiB)   Min(MiB)  Mean(MiB)     StdDev   Max(OPs)   Min(OPs)  Mean(OPs)     StdDev    Mean(s) Stonewall(s) Stonewall(MiB) Test# #Tasks tPN reps fPP reord reordoff reordrand seed segcnt   blksiz    xsize aggs(MiB)   API RefNum
write        1949.03    1949.03    1949.03       0.00    7796.10    7796.10    7796.10       0.00    0.00051         NA            NA     0      1   1    1   0     0        1         0    0      1  1048576   262144       1.0 POSIX      0

the match seems to work, but when I try to print out some values

        print(found_measures)

I got the error

File "/home/simone/Documents/reframe-test/ior_reframe_run_bench_only.py", line 22, in __init__
    print(found_measures)
  File "/home/simone/EasyBuild_INSTALL/software/ReFrame/2.19/lib/python3.6/site-packages/ReFrame_HPC-2.19-py3.6.egg/reframe/core/deferrable.py", line 69, in __str__
    return str(self.evaluate())
  File "/home/simone/EasyBuild_INSTALL/software/ReFrame/2.19/lib/python3.6/site-packages/ReFrame_HPC-2.19-py3.6.egg/reframe/core/deferrable.py", line 46, in evaluate
    arg.evaluate() if isinstance(arg, type(self)) else arg)
  File "/home/simone/EasyBuild_INSTALL/software/ReFrame/2.19/lib/python3.6/site-packages/ReFrame_HPC-2.19-py3.6.egg/reframe/core/deferrable.py", line 53, in evaluate
    ret = self._fn(*fn_args, **fn_kwargs)
  File "/home/simone/EasyBuild_INSTALL/software/ReFrame/2.19/lib/python3.6/site-packages/ReFrame_HPC-2.19-py3.6.egg/reframe/core/pipeline.py", line 744, in stdout
    return self._job.stdout
AttributeError: 'NoneType' object has no attribute 'stdout'

So, I was wondering, how can I print the elements of my match ?
Is it possible to use something like

 print(found_measures.group(1))

to obtain the single strings of the regular expression match ?

Thanks for the help, maybe it is a simple question but I have not found something about that inside Reframe documentation.

Thanks

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions