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
1=== modified file 'lava_dispatcher/actions/lava-test.py'
2--- lava_dispatcher/actions/lava-test.py 2011-06-28 14:11:21 +0000
3+++ lava_dispatcher/actions/lava-test.py 2011-06-30 05:18:29 +0000
4@@ -20,6 +20,7 @@
5 # along
6 # with this program; if not, see <http://www.gnu.org/licenses>.
7
8+from datetime import datetime
9 from lava_dispatcher.actions import BaseAction
10 from lava_dispatcher.client import OperationFailed
11 from lava_dispatcher.config import LAVA_RESULT_DIR, MASTER_STR, TESTER_STR
12@@ -32,9 +33,11 @@
13 client.run_shell_command('mkdir -p %s' % LAVA_RESULT_DIR,
14 response = TESTER_STR)
15 client.export_display()
16+ dt = datetime.now()
17+ bundle_name = test_name + "-" + str(dt.hour) + str(dt.minute) + str(dt.second)
18 client.run_shell_command(
19 'lava-test run %s -o %s/%s.bundle' % (
20- test_name, LAVA_RESULT_DIR, test_name),
21+ test_name, LAVA_RESULT_DIR, bundle_name),
22 response = TESTER_STR, timeout = timeout)
23
24 class cmd_lava_test_install(BaseAction):

Subscribers

People subscribed via source and target branches