Merge lp:~qzhang/lava-dispatcher/unique-bundle-name into lp:lava-dispatcher

Proposed by Spring Zhang
Status: Merged
Merged at revision: 73
Proposed branch: lp:~qzhang/lava-dispatcher/unique-bundle-name
Merge into: lp:lava-dispatcher
Diff against target: 24 lines (+4/-1)
1 file modified
lava_dispatcher/actions/lava-test.py (+4/-1)
To merge this branch: bzr merge lp:~qzhang/lava-dispatcher/unique-bundle-name
Reviewer Review Type Date Requested Status
Paul Larson (community) Approve
Review via email: mp+66412@code.launchpad.net

Description of the change

fix #768453
add time string to result bundle name

To post a comment you must log in.
Revision history for this message
Paul Larson (pwlars) wrote :

16 + dt = datetime.now()
17 + bundle_name = test_name + "-" + str(dt.hour) + str(dt.minute) + str(dt.second)
Seems sensible enough to add a timestamp for uniqueness, but I think I'd rather add a more traditional timestamp. Just use time.time() to get a timestamp instead of all this. It's shorter and easier :)

Otherwise, looks good, thanks!

review: Approve
Revision history for this message
Spring Zhang (qzhang) wrote :

Thanks for the comments, I adjust the code to an easier way but I think it's meaningful to keep some time info in file name than total seconds from 1970

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lava_dispatcher/actions/lava-test.py'
--- lava_dispatcher/actions/lava-test.py 2011-06-28 14:11:21 +0000
+++ lava_dispatcher/actions/lava-test.py 2011-06-30 05:18:29 +0000
@@ -20,6 +20,7 @@
20# along20# along
21# with this program; if not, see <http://www.gnu.org/licenses>.21# with this program; if not, see <http://www.gnu.org/licenses>.
2222
23from datetime import datetime
23from lava_dispatcher.actions import BaseAction24from lava_dispatcher.actions import BaseAction
24from lava_dispatcher.client import OperationFailed25from lava_dispatcher.client import OperationFailed
25from lava_dispatcher.config import LAVA_RESULT_DIR, MASTER_STR, TESTER_STR26from lava_dispatcher.config import LAVA_RESULT_DIR, MASTER_STR, TESTER_STR
@@ -32,9 +33,11 @@
32 client.run_shell_command('mkdir -p %s' % LAVA_RESULT_DIR,33 client.run_shell_command('mkdir -p %s' % LAVA_RESULT_DIR,
33 response = TESTER_STR)34 response = TESTER_STR)
34 client.export_display()35 client.export_display()
36 dt = datetime.now()
37 bundle_name = test_name + "-" + str(dt.hour) + str(dt.minute) + str(dt.second)
35 client.run_shell_command(38 client.run_shell_command(
36 'lava-test run %s -o %s/%s.bundle' % (39 'lava-test run %s -o %s/%s.bundle' % (
37 test_name, LAVA_RESULT_DIR, test_name),40 test_name, LAVA_RESULT_DIR, bundle_name),
38 response = TESTER_STR, timeout = timeout)41 response = TESTER_STR, timeout = timeout)
3942
40class cmd_lava_test_install(BaseAction):43class cmd_lava_test_install(BaseAction):

Subscribers

People subscribed via source and target branches