Function dev_db_get_name() is here called twice and can be reduced to only one call. Because it queries Slave machine n times, where n is size of device database on Slave, it can take a lot of time when database is large.
This reduces time it takes to return from this function to a half.
Signed-off-by: Jiri Prochazka jprochaz@redhat.com --- lnst/Controller/Task.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lnst/Controller/Task.py b/lnst/Controller/Task.py index 4f4a772..af1db96 100644 --- a/lnst/Controller/Task.py +++ b/lnst/Controller/Task.py @@ -314,7 +314,7 @@ class HostAPI(object): def get_device(self, name): dev = self._m.dev_db_get_name(name) if dev: - return DeviceAPI(self._m.dev_db_get_name(name), self) + return DeviceAPI(dev, self) else: raise TaskError("No device with name '%s' found." % str(name))
Thu, Mar 30, 2017 at 11:58:46AM CEST, jprochaz@redhat.com wrote:
Function dev_db_get_name() is here called twice and can be reduced to only one call. Because it queries Slave machine n times, where n is size of device database on Slave, it can take a lot of time when database is large.
This reduces time it takes to return from this function to a half.
Signed-off-by: Jiri Prochazka jprochaz@redhat.com
Acked-by: Jan Tluka jtluka@redhat.com
On Thu, Mar 30, 2017 at 11:58:46AM +0200, Jiri Prochazka wrote:
Function dev_db_get_name() is here called twice and can be reduced to only one call. Because it queries Slave machine n times, where n is size of device database on Slave, it can take a lot of time when database is large.
This reduces time it takes to return from this function to a half.
Signed-off-by: Jiri Prochazka jprochaz@redhat.com
lnst/Controller/Task.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lnst/Controller/Task.py b/lnst/Controller/Task.py index 4f4a772..af1db96 100644 --- a/lnst/Controller/Task.py +++ b/lnst/Controller/Task.py @@ -314,7 +314,7 @@ class HostAPI(object): def get_device(self, name): dev = self._m.dev_db_get_name(name) if dev:
return DeviceAPI(self._m.dev_db_get_name(name), self)
return DeviceAPI(dev, self) else: raise TaskError("No device with name '%s' found." % str(name))
-- 2.9.3 _______________________________________________ LNST-developers mailing list -- lnst-developers@lists.fedorahosted.org To unsubscribe send an email to lnst-developers-leave@lists.fedorahosted.org
Acked-by: Ondrej Lichtner olichtne@redhat.com
Thu, Mar 30, 2017 at 11:58:46AM CEST, jprochaz@redhat.com wrote:
Function dev_db_get_name() is here called twice and can be reduced to only one call. Because it queries Slave machine n times, where n is size of device database on Slave, it can take a lot of time when database is large.
This reduces time it takes to return from this function to a half.
Signed-off-by: Jiri Prochazka jprochaz@redhat.com
Pushed. Thanks!
-Jan
lnst-developers@lists.fedorahosted.org