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

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

Merged
merged 1 commit into from
Jul 24, 2021

Conversation

stepanblyschak
Copy link
Collaborator

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

To remove old W/A I introduced, that seems no longer needed nor giving some improvement.

How I did it

How to verify it

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]>
@lgtm-com
Copy link

lgtm-com bot commented Jul 20, 2021

This pull request fixes 1 alert when merging a9d682f into 950c24c - view on LGTM.com

fixed alerts:

  • 1 for Unused import

@stepanblyschak
Copy link
Collaborator Author

/azpw run

@mssonicbld
Copy link
Collaborator

/AzurePipelines run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Contributor

@tahmed-dev tahmed-dev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Stepan!

@tahmed-dev tahmed-dev merged commit 5361794 into sonic-net:master Jul 24, 2021
carl-nokia pushed a commit to carl-nokia/sonic-buildimage that referenced this pull request Aug 7, 2021
…ne (sonic-net#8226)

lazy_re had an issue when importing sonic-cfggen in another application that
uses re.search(). There is no much improvement 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 calls is greatly 
reduced in latest SONiC. This means it is time to revert this change.

Signed-off-by: Stepan Blyschak <[email protected]>
@dgsudharsan
Copy link
Collaborator

Required for 202106

judyjoseph pushed a commit that referenced this pull request Oct 14, 2021
…ne (#8226)

lazy_re had an issue when importing sonic-cfggen in another application that
uses re.search(). There is no much improvement 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 calls is greatly 
reduced in latest SONiC. This means it is time to revert this change.

Signed-off-by: Stepan Blyschak <[email protected]>
@stepanblyschak stepanblyschak deleted the remove_lazy_re branch September 23, 2022 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants