Skip to content

[sonic-cfggen] remove lazy_re workaround due to many optimizations done#47

Closed
stepanblyschak wants to merge 1 commit intomasterfrom
remove_lazy_re
Closed

[sonic-cfggen] remove lazy_re workaround due to many optimizations done#47
stepanblyschak wants to merge 1 commit intomasterfrom
remove_lazy_re

Conversation

@stepanblyschak
Copy link
Copy Markdown
Owner

lazy_re had an issue when importing sonic-cfggen in another application that
uses re.search():

Traceback (most recent call last):
  File "/usr/local/bin/spm", line 8, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/sonic_package_manager/main.py", line 202, in list
    click.echo(tabulate.tabulate(table_body, table_header))
  File "/usr/local/lib/python3.7/dist-packages/tabulate.py", line 1259, in tabulate
    has_invisible = re.search(_invisible_codes, plain_text)
  File "/usr/lib/python3.7/re.py", line 183, in search
    return _compile(pattern, flags).search(string)
  File "/usr/lib/python3.7/re.py", line 285, in _compile
    raise TypeError("first argument must be string or compiled pattern")
TypeError: first argument must be string or compiled pattern

There is no much imporvement of lazy_re today after many other good optimization work
done for sonic-cfggen. It served as a quick temporary solution.

Some quick test for fast-reboot and warm-reboot done on top of 201911 branch:

Fast-reboot: from ASIC reset to ports in up state:
with lazy_re: 18 sec
without lazy_re: 18 sec

Warm-reboot: LAG restoration time:
with lazy_re: 73 sec
without lazy_re: 72 sec

So, there is no real optimization since the number of sonic-cfggen is grately reduced
in latest SONiC. This means it is time to revert this change.

Signed-off-by: Stepan Blyschak [email protected]

Why I did it

Remove W/A that I introduced a while ago that seems no longer needed nor gives some improvement.

How I did it

Removed lazy_re.

How to verify it

Ran fast-reboot, warm-reboot and do not observe degradations.

Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106

Description for the changelog

A picture of a cute animal (not mandatory but encouraged)

lazy_re had an issue when importing sonic-cfggen in another application that
uses re.search():

```
Traceback (most recent call last):
  File "/usr/local/bin/spm", line 8, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.7/dist-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/sonic_package_manager/main.py", line 202, in list
    click.echo(tabulate.tabulate(table_body, table_header))
  File "/usr/local/lib/python3.7/dist-packages/tabulate.py", line 1259, in tabulate
    has_invisible = re.search(_invisible_codes, plain_text)
  File "/usr/lib/python3.7/re.py", line 183, in search
    return _compile(pattern, flags).search(string)
  File "/usr/lib/python3.7/re.py", line 285, in _compile
    raise TypeError("first argument must be string or compiled pattern")
TypeError: first argument must be string or compiled pattern
```

There is no much imporvement of lazy_re today after many other good optimization work
done for sonic-cfggen. It served as a quick temporary solution.

Some quick test for fast-reboot and warm-reboot done on top of 201911 branch:

Fast-reboot: from ASIC reset to ports in up state:
with lazy_re: 18 sec
without lazy_re: 18 sec

Warm-reboot: LAG restoration time:
with lazy_re: 73 sec
without lazy_re: 72 sec

So, there is no real optimization since the number of sonic-cfggen is grately reduced
in latest SONiC. This means it is time to revert this change.

Signed-off-by: Stepan Blyschak <[email protected]>
stepanblyschak pushed a commit that referenced this pull request Apr 3, 2022
…onic-net#10406)

#### Why I did it
To take the following into sonic-buildimage
36e1f61 API endpoints to ConfigDBConnector to support pre-loading data without blackout (sonic-net#587)

[sonic-swss-common](https://github.com/Azure/sonic-swss-common)
```
36e1f61 API endpoints to ConfigDBConnector to support pre-loading data without blackout (sonic-net#587)
556f4ad Add SAI copy action to ACL schema (sonic-net#591)
db18c3a Fix bitwidth of mac address in SAI ACL schema (sonic-net#590)
e9442bb [ConfigDBPipeConnector]: Added set_entry API (sonic-net#586)
6c007c0 Update README for gmock (sonic-net#562)
```

[sonic-linkmgrd](https://github.com/Azure/sonic-linkmgrd)
```
83dfc99 Enforce uniform file/class naming convention (#52)
83004bf Shutdown ICMP heartbeats when default route state is missing and ToR is in `auto` mode (#44)
b81ea31 Add `LinkProberStateMachineActiveActive`  (#47)
c43cf7a Decrease link probing interval after switchover to better determine the overhead of a toggle (#43)
2239fbe Enhance clang format (#46)
```
#### How I did it
* Advanced submodules pointers

#### How to verify it
1. make configure PLATFORM=mellanox
2. make target/sonic-mellanox.bin
@stepanblyschak stepanblyschak deleted the remove_lazy_re branch September 23, 2022 13:33
stepanblyschak pushed a commit that referenced this pull request Feb 24, 2025
…ly (sonic-net#21743)

#### Why I did it
src/sonic-stp
```
* 29eb387 - (HEAD -> master, origin/master, origin/HEAD) Fixing compilaion error for marvell_armhf (#47) (9 hours ago) [Divya Kumaran Chandralekha]
* b7da558 - Merge pull request #44 from wajahatrazi/stp_co_pr (3 days ago) [Divya Kumaran Chandralekha]
|\ 
| failure_prs.log skip_prs.log 47e1e77 - Merge branch 'master' into stp_co_pr (3 days ago) [Divya Kumaran Chandralekha]
| |\ 
| |/ 
|/| 
* | 6e4a94f - Merge pull request #46 from divyachandralekha/pvst_pr_1 (4 days ago) [Divya Kumaran Chandralekha]
|\ \ 
| failure_prs.log skip_prs.log | aa5e824 - libevent explicit building dependency removed (4 days ago) [Divya Chandralekha]
|/ / 
* | 9345e5a - Merge pull request #43 from omaaartamer/fix/alignment-warnings (5 days ago) [Divya Kumaran Chandralekha]
* | eedb772 - [stp] Add memory alignment padding to structures (9 weeks ago) [omaaartamer]
* | 128e53d - fix: resolve STP alignment warnings (9 weeks ago) [omaaartamer]
 / 
* 30febfa - Fixing changes in the code (9 weeks ago) [Wajahat Razi]
```
#### How I did it
#### How to verify it
#### Description for the changelog
stepanblyschak pushed a commit that referenced this pull request Oct 1, 2025
…sonic-net#23653)

#### Why I did it
src/dhcpmon
```
* 35a907b - (HEAD -> 202505, origin/202505) [build] Update to install libyang3 in PR check (#47) (2 days ago) [mssonicbld]
```
#### How I did it
#### How to verify it
#### Description for the changelog
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

Successfully merging this pull request may close these issues.

2 participants