Skip to contentSkip to conversation

Make client behavior configurable: drop_caches

PATCH In review Lucas Meneghel Rodrigues 2 participants 4 messages Nov 5, 2009 – Nov 11, 2009 KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Make client behavior configurable: drop_caches

Right now autotest will drop caches between:
* Test executions
* Same test iterations

This change turns those into configurable options on global_config.ini. Default configuration:

[CLIENT]
drop_caches: True
drop_caches_between_iterations: True

---
 client/bin/autotest |    7 ++++++-
 client/bin/job.py   |   11 ++++++++---
 global_config.ini   |    7 ++++++-
 3 files changed, 20 insertions(+), 5 deletions(-)
client/bin/autotest +6 -1
index fe8f2c7..2d47843 100755
@@ -6,6 +6,7 @@ import os, sys, shutil
 import common
 from optparse import OptionParser
 from autotest_lib.client.bin import job
+from autotest_lib.client.common_lib import global_config
 
 
 # Use the name of the binary to find the real installation directory
@@ -58,5 +59,9 @@ options, args = parser.parse_args()
 if len(args) != 1:
     usage()
 
+drop_caches = global_config.global_config.get_config_value('CLIENT',
+                                                           'drop_caches',
+                                                           type=bool)
+
 # JOB: run the specified job control file.
-job.runjob(os.path.realpath(args[0]), options)
+job.runjob(os.path.realpath(args[0]), drop_caches, options)
client/bin/job.py +8 -3
index ebfb3a3..6099188 100755
@@ -15,6 +15,8 @@ from autotest_lib.client.bin import config, sysinfo, test, local_host
 from autotest_lib.client.bin import partition as partition_lib
 from autotest_lib.client.common_lib import error, barrier, log, logging_manager
 from autotest_lib.client.common_lib import base_packages, packages
+from autotest_lib.client.common_lib import global_config
+
 
 LAST_BOOT_TAG = object()
 NO_DEFAULT = object()
@@ -251,7 +253,10 @@ class base_job(object):
         """
         Perform the drop caches initialization.
         """
-        self.drop_caches_between_iterations = True
+        self.drop_caches_between_iterations = (
+                       global_config.global_config.get_config_value('CLIENT',
+                                            'drop_caches_between_iterations',
+                                            type=bool))
         self.drop_caches = drop_caches
         if self.drop_caches:
             logging.debug("Dropping caches")
@@ -1339,7 +1344,7 @@ class disk_usage_monitor:
         return decorator
 
 
-def runjob(control, options):
+def runjob(control, drop_caches, options):
     """
     Run a job using the given control file.
 
@@ -1367,7 +1372,7 @@ def runjob(control, options):
         if options.cont and not os.path.exists(state):
             raise error.JobComplete("all done")
 
-        myjob = job(control, options)
+        myjob = job(control=control, drop_caches=drop_caches, options=options)
 
         # Load in the users control file, may do any one of:
         #  1) execute in toto
global_config.ini +6 -1
index cc20a96..d018374 100644
@@ -28,7 +28,6 @@ parse_failed_repair_default: 0
 # Autotest potential install paths
 client_autodir_paths: /usr/local/autotest,/home/autotest
 
-
 [SERVER]
 hostname: autotest
 # Turn on RPC Logging
@@ -48,6 +47,12 @@ smtp_port:
 smtp_user:
 smtp_password:
 
+[CLIENT]
+# Drop test client caches between every test execution
+drop_caches: True
+# Drop test client caches between every test iteration execution
+drop_caches_between_iterations: True
+
 [SCHEDULER]
 die_on_orphans: False
 enable_scheduler: True
Signature · 1 line
1.6.2.5
#1 lore raw

Will this code actually work on a standalone client job? I'm not sure we've ever used global_config stuff outside of the server (despite the fact that the code lives in the common_lib).

-- John

Quoted 113 lines · Lucas Meneghel Rodrigues

Right now autotest will drop caches between:
 * Test executions
 * Same test iterations

This change turns those into configurable options on global_config.ini. Default configuration:

[CLIENT]
drop_caches: True
drop_caches_between_iterations: True

---
 client/bin/autotest |    7 ++++++-
 client/bin/job.py   |   11 ++++++++---
 global_config.ini   |    7 ++++++-

 3 files changed, 20 insertions(+), 5 deletions(-)
client/bin/autotest +0 -0
index fe8f2c7..2d47843 100755
@@ -6,6 +6,7 @@ import os, sys, shutil

 import common
 from optparse import OptionParser
 from autotest_lib.client.bin import job
+from autotest_lib.client.common_lib import global_config

 # Use the name of the binary to find the real installation directory

client/bin/autotest +0 -0
@@ -58,5 +59,9 @@ options, args = parser.parse_args()

 if len(args) != 1:
    usage()

client/bin/autotest +4 -0
+drop_caches = global_config.global_config.get_config_value('CLIENT',
+                                                           'drop_caches',
+                                                           type=bool)
+

 # JOB: run the specified job control file.

client/bin/autotest +1 -1
-job.runjob(os.path.realpath(args[0]), options)
+job.runjob(os.path.realpath(args[0]), drop_caches, options)
client/bin/job.py +0 -0
index ebfb3a3..6099188 100755
@@ -15,6 +15,8 @@ from autotest_lib.client.bin import config, sysinfo, test, local_host

 from autotest_lib.client.bin import partition as partition_lib from autotest_lib.client.common_lib import error, barrier, log, logging_manager from autotest_lib.client.common_lib import base_packages, packages

client/bin/job.py +2 -0
+from autotest_lib.client.common_lib import global_config
+

 LAST_BOOT_TAG = object()
 NO_DEFAULT = object()

client/bin/job.py +0 -0
@@ -251,7 +253,10 @@ class base_job(object):

        """
        Perform the drop caches initialization.
        """
-        self.drop_caches_between_iterations = True
+        self.drop_caches_between_iterations = (
+                       global_config.global_config.get_config_value('CLIENT',
+                                            'drop_caches_between_iterations',
+                                            type=bool)) self.drop_caches = drop_caches
        if self.drop_caches:
            logging.debug("Dropping caches")

client/bin/job.py +0 -0
@@ -1339,7 +1344,7 @@ class disk_usage_monitor:

        return decorator

client/bin/job.py +1 -1
-def runjob(control, options):
+def runjob(control, drop_caches, options):

    """
    Run a job using the given control file.

client/bin/job.py +0 -0
@@ -1367,7 +1372,7 @@ def runjob(control, options):

        if options.cont and not os.path.exists(state):
            raise error.JobComplete("all done")

-        myjob = job(control, options)
+        myjob = job(control=control, drop_caches=drop_caches, options=options)

        # Load in the users control file, may do any one of:
        #  1) execute in toto

global_config.ini +0 -0
index cc20a96..d018374 100644
@@ -28,7 +28,6 @@ parse_failed_repair_default: 0
  # Autotest potential install paths

 client_autodir_paths: /usr/local/autotest,/home/autotest

-
 [SERVER]
 hostname: autotest
 # Turn on RPC Logging

global_config.ini +0 -0
@@ -48,6 +47,12 @@ smtp_port:

 smtp_user:
 smtp_password:

+[CLIENT]

global_config.ini +5 -0
+# Drop test client caches between every test execution
+drop_caches: True
+# Drop test client caches between every test iteration execution
+drop_caches_between_iterations: True
+

 [SCHEDULER]
 die_on_orphans: False
 enable_scheduler: True
--
1.6.2.5

#2 lore raw
Quoted 3 lines · John Admanski

Will this code actually work on a standalone client job? I'm not sure we've ever used global_config stuff outside of the server (despite the fact that the code lives in the common_lib).

Whoops, I just forgot that global_config.ini is a top level file. 2 possible solutions:

1 - Move global_config.ini to client/
2 - Create a specific configuration file for client.

But yes, the patch has already been applied and introduces a regression since the stand alone client won't be able to see global_config.ini. I am sorry.

I believe solution 1) is not bad, client/global_config.ini is just slightly non intuitive, but splitting conf files does not sound like a better idea.

Quoted 121 lines

-- John

Quoted 110 lines · Lucas Meneghel Rodrigues

Right now autotest will drop caches between:
* Test executions
* Same test iterations

This change turns those into configurable options on global_config.ini. Default configuration:

[CLIENT]
drop_caches: True
drop_caches_between_iterations: True

---
 client/bin/autotest |    7 ++++++-
 client/bin/job.py   |   11 ++++++++---
 global_config.ini   |    7 ++++++-
 3 files changed, 20 insertions(+), 5 deletions(-)
client/bin/autotest +6 -1
index fe8f2c7..2d47843 100755
@@ -6,6 +6,7 @@ import os, sys, shutil
 import common
 from optparse import OptionParser
 from autotest_lib.client.bin import job
+from autotest_lib.client.common_lib import global_config
 
 
 # Use the name of the binary to find the real installation directory
@@ -58,5 +59,9 @@ options, args = parser.parse_args()
 if len(args) != 1:
    usage()
 
+drop_caches = global_config.global_config.get_config_value('CLIENT',
+                                                           'drop_caches',
+                                                           type=bool)
+
 # JOB: run the specified job control file.
-job.runjob(os.path.realpath(args[0]), options)
+job.runjob(os.path.realpath(args[0]), drop_caches, options)
client/bin/job.py +8 -3
index ebfb3a3..6099188 100755
@@ -15,6 +15,8 @@ from autotest_lib.client.bin import config, sysinfo, test, local_host
 from autotest_lib.client.bin import partition as partition_lib
 from autotest_lib.client.common_lib import error, barrier, log, logging_manager
 from autotest_lib.client.common_lib import base_packages, packages
+from autotest_lib.client.common_lib import global_config
+
 
 LAST_BOOT_TAG = object()
 NO_DEFAULT = object()
@@ -251,7 +253,10 @@ class base_job(object):
        """
        Perform the drop caches initialization.
        """
-        self.drop_caches_between_iterations = True
+        self.drop_caches_between_iterations = (
+                       global_config.global_config.get_config_value('CLIENT',
+                                            'drop_caches_between_iterations',
+                                            type=bool))
        self.drop_caches = drop_caches
        if self.drop_caches:
            logging.debug("Dropping caches")
@@ -1339,7 +1344,7 @@ class disk_usage_monitor:
        return decorator
 
 
-def runjob(control, options):
+def runjob(control, drop_caches, options):
    """
    Run a job using the given control file.
 
@@ -1367,7 +1372,7 @@ def runjob(control, options):
        if options.cont and not os.path.exists(state):
            raise error.JobComplete("all done")
 
-        myjob = job(control, options)
+        myjob = job(control=control, drop_caches=drop_caches, options=options)
 
        # Load in the users control file, may do any one of:
        #  1) execute in toto
global_config.ini +6 -2
index cc20a96..d018374 100644
@@ -28,7 +28,6 @@ parse_failed_repair_default: 0
 # Autotest potential install paths
 client_autodir_paths: /usr/local/autotest,/home/autotest
 
-
 [SERVER]
 hostname: autotest
 # Turn on RPC Logging
@@ -48,6 +47,12 @@ smtp_port:
 smtp_user:
 smtp_password:
 
+[CLIENT]
+# Drop test client caches between every test execution
+drop_caches: True
+# Drop test client caches between every test iteration execution
+drop_caches_between_iterations: True
+
 [SCHEDULER]
 die_on_orphans: False
 enable_scheduler: True
--
Quoted 3 lines

1.6.2.5

--
To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
In reply to John Admanski
Quoted 3 lines · John Admanski

Will this code actually work on a standalone client job? I'm not sure we've ever used global_config stuff outside of the server (despite the fact that the code lives in the common_lib).

I've sent 2 patches to the mailing list:

1) Fix an incorrect directory reference on the job code (fixes autoserv)
2) Moves the config files to the client directory (fixes autotest stand alone)

Both were tested and does not seem to regress the unittest suites.

I hope that with this patch things will get straightened out.

Quoted 122 lines

-- John

Quoted 106 lines · Lucas Meneghel Rodrigues

Right now autotest will drop caches between:
 * Test executions
 * Same test iterations

This change turns those into configurable options on global_config.ini. Default configuration:

[CLIENT]
drop_caches: True
drop_caches_between_iterations: True

---
 client/bin/autotest |    7 ++++++-
 client/bin/job.py   |   11 ++++++++---
 global_config.ini   |    7 ++++++-

 3 files changed, 20 insertions(+), 5 deletions(-)
client/bin/autotest +0 -0
index fe8f2c7..2d47843 100755
@@ -6,6 +6,7 @@ import os, sys, shutil

 import common
 from optparse import OptionParser
 from autotest_lib.client.bin import job
+from autotest_lib.client.common_lib import global_config

 # Use the name of the binary to find the real installation directory

client/bin/autotest +0 -0
@@ -58,5 +59,9 @@ options, args = parser.parse_args()

 if len(args) != 1:
    usage()

client/bin/autotest +4 -0
+drop_caches = global_config.global_config.get_config_value('CLIENT',
+                                                           'drop_caches',
+                                                           type=bool)
+

 # JOB: run the specified job control file.

client/bin/autotest +1 -1
-job.runjob(os.path.realpath(args[0]), options)
+job.runjob(os.path.realpath(args[0]), drop_caches, options)
client/bin/job.py +0 -0
index ebfb3a3..6099188 100755
@@ -15,6 +15,8 @@ from autotest_lib.client.bin import config, sysinfo, test, local_host

 from autotest_lib.client.bin import partition as partition_lib from autotest_lib.client.common_lib import error, barrier, log, logging_manager from autotest_lib.client.common_lib import base_packages, packages

client/bin/job.py +2 -0
+from autotest_lib.client.common_lib import global_config
+

 LAST_BOOT_TAG = object()
 NO_DEFAULT = object()

client/bin/job.py +0 -0
@@ -251,7 +253,10 @@ class base_job(object):

        """
        Perform the drop caches initialization.
        """
-        self.drop_caches_between_iterations = True
+        self.drop_caches_between_iterations = (
+                       global_config.global_config.get_config_value('CLIENT',
+                                            'drop_caches_between_iterations',
+                                            type=bool)) self.drop_caches = drop_caches
        if self.drop_caches:
            logging.debug("Dropping caches")

client/bin/job.py +0 -0
@@ -1339,7 +1344,7 @@ class disk_usage_monitor:

        return decorator

client/bin/job.py +1 -1
-def runjob(control, options):
+def runjob(control, drop_caches, options):

    """
    Run a job using the given control file.

client/bin/job.py +0 -0
@@ -1367,7 +1372,7 @@ def runjob(control, options):

        if options.cont and not os.path.exists(state):
            raise error.JobComplete("all done")

-        myjob = job(control, options)
+        myjob = job(control=control, drop_caches=drop_caches, options=options)

        # Load in the users control file, may do any one of:
        #  1) execute in toto

global_config.ini +0 -0
index cc20a96..d018374 100644
@@ -28,7 +28,6 @@ parse_failed_repair_default: 0
  # Autotest potential install paths

 client_autodir_paths: /usr/local/autotest,/home/autotest

-
 [SERVER]
 hostname: autotest
 # Turn on RPC Logging

global_config.ini +0 -0
@@ -48,6 +47,12 @@ smtp_port:

 smtp_user:
 smtp_password:

+[CLIENT]

global_config.ini +5 -0
+# Drop test client caches between every test execution
+drop_caches: True
+# Drop test client caches between every test iteration execution
+drop_caches_between_iterations: True
+
Quoted 7 lines

 [SCHEDULER]
 die_on_orphans: False
 enable_scheduler: True
--
1.6.2.5

_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Signature · 1 line
Lucas