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

Axial Expansion Changer + verbosity: debug #1048

Open
albeanth opened this issue Dec 22, 2022 · 5 comments · Fixed by #1063 · May be fixed by #1338
Open

Axial Expansion Changer + verbosity: debug #1048

albeanth opened this issue Dec 22, 2022 · 5 comments · Fixed by #1063 · May be fixed by #1338
Labels
cleanup Code/comment cleanup: Low Priority

Comments

@albeanth
Copy link
Member

When the verbosity is set to debug, too much information is printed to the screen. It really clutters up the stdout. This is particularly true for:

  1. if lowerLinkedBlock is None:
    runLog.debug(
    "Assembly {0:22s} at location {1:22s}, Block {2:22s}"
    "is not linked to a block below!".format(
    str(self.a.getName()),
    str(self.a.getLocation()),
    str(b.p.flags),
    )
    )
    if upperLinkedBlock is None:
    runLog.debug(
    "Assembly {0:22s} at location {1:22s}, Block {2:22s}"
    "is not linked to a block above!".format(
    str(self.a.getName()),
    str(self.a.getLocation()),
    str(b.p.flags),
    )
    )
  2. if lstLinkedC[0] is None:
    runLog.debug(
    "Assembly {0:22s} at location {1:22s}, Block {2:22s}, Component {3:22s} "
    "has nothing linked below it!".format(
    str(self.a.getName()),
    str(self.a.getLocation()),
    str(b.p.flags),
    str(c.p.flags),
    )
    )
    if lstLinkedC[1] is None:
    runLog.debug(
    "Assembly {0:22s} at location {1:22s}, Block {2:22s}, Component {3:22s} "
    "has nothing linked above it!".format(
    str(self.a.getName()),
    str(self.a.getLocation()),
    str(b.p.flags),
    str(c.p.flags),
    )
    )

These are indeed useful but they print way too many times and after the first time they are printed, they are just a nuisance.

@albeanth albeanth added the cleanup Code/comment cleanup: Low Priority label Dec 22, 2022
@john-science
Copy link
Member

john-science commented Dec 27, 2022

Fun Fact: I built some tooling so that you can force a log line to only ever be printed the first time, and not repeatedly:

def log(self, msgType, msg, single=False, label=None, **kwargs):

We use it in several places now:

runLog.warning(
f"Theoretical density frac for {self} is {TD_frac}, which is >1",
single=True,
label="Large theoretical density",
)

So... how about that?

The only real downside is we shouldn't do this EVERYWHERE, because the logger code would constantly be comparing thousands of strings. Still, if there is a single eye-sore debug log, this is an easy win.

@albeanth
Copy link
Member Author

albeanth commented Mar 16, 2023

I'm currently helping debug a downstream ARMI project with verbosity: debug and the output is still printed in the stdout too much. The problem is that the axial expansion changer prints information at the component level for every single assembly in the core. It can result in 10s of thousands of lines of information.

I think the single approach didn't take because we fire up instances of the changer so often. Not 100% sure, but that makes sense, I think.

Ultimately, I think there is value in the axial expansion changer printing info at the component level, but having to parse through 10s of thousands of lines just isn't sustainable. This needs a new solution and it might be to hack back how much is actually getting printed or being smarter about it.

@albeanth
Copy link
Member Author

albeanth commented Mar 16, 2023

I think something like a try/else statement wrapped around

def axiallyExpandAssembly(self):

might be reasonable. So if a given assembly fails during expansion for whatever reason, then we can print relevant information to the runLog that has been stored. That way during a debug run we are always collecting the relevant information, but not just printing it full bore for every single component for every single assembly, but rather only if an assembly fails in the expansion routine.

@john-science
Copy link
Member

@albeanth This ticket is still assigned to you. That's cool with me, but if you aren't planning on working on it, please un-assign it.

(You are not being singled out, I am going through all the ARMI tickets.)

@albeanth albeanth removed their assignment Mar 12, 2024
@albeanth
Copy link
Member Author

Just un-assigned myself so someone else can work on it if they'd like.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleanup Code/comment cleanup: Low Priority
Projects
None yet
2 participants