Megatest

Check-in [5cdc4cd6d0]
Login
Overview
Comment:Basics of get data in place
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | v1.60
Files: files | file ages | folders
SHA1: 5cdc4cd6d0c6fe6627e6177e51678251ddeb7b63
User & Date: matt on 2014-08-23 13:58:45
Other Links: branch diff | manifest | tags
Context
2014-08-24
17:08
More datashare hacking done. check-in: 564660d855 user: matt tags: v1.60
2014-08-23
13:58
Basics of get data in place check-in: 5cdc4cd6d0 user: matt tags: v1.60
2014-08-22
16:53
More of datashare working check-in: 8d86e61bbb user: mrwellan tags: v1.60
Changes

Modified Makefile from [f67108acbc] to [52d90a724c].

166
167
168
169
170
171
172

173
174
175
176


166
167
168
169
170
171
172
173
174
175
176

177
178







+



-
+
+
deploytarg/dboard :  $(OFILES) $(GOFILES) dashboard.scm deploytarg/apropos.so
	csc -deploy $(OFILES) $(GOFILES) dashboard.scm -o deploytarg
	mv deploytarg/deploytarg deploytarg/dboard

# DATASHAREO=configf.o common.o process.o tree.o dcommon.o margs.o launch.o gutils.o db.o synchash.o server.o \
#            megatest-version.o tdb.o ods.o mt.o keys.o
datashare-testing/datashare : datashare.scm $(OFILES)
	mkdir -p /tmp/$(USER)/datashare /tmp/$(USER)/datashare/disk1
	csc datashare.scm $(OFILES) -o datashare-testing/datashare

datashare : datashare-testing/datashare
	./datashare-testing/datashare
	BASEPATH=/tmp/$(USER)/basepath ./datashare-testing/datashare

Modified datashare-testing/.datashare.config from [c947741ed2] to [ff6a52c3eb].

1



2

3


4
5





6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22








1
2
3
4

5
6
7
8


9
10
11
12
13
14
15
16
17
18
19



20
21
22
23
24
25
26

27
28
29
30
31
32
33
34

+
+
+
-
+

+
+
-
-
+
+
+
+
+






-
-
-







-
+
+
+
+
+
+
+
+
# Read in the users vars first (so the offical data cannot be overridden
[include ~/.datashare.config]

# Read in local overrides
[include datastore.config]
[include datashare.config]

# Replace [storage] with settings entry - more secure
[settings]
[storage]
1 /tmp/datastore/eng

storage /tmp/#{getenv USER}/datashare/disk1 \
        /tmp/#{getenv USER}/datashare/disk2

basepath #{getenv BASEPATH}

[areas]
synthesis  asic/synthesis
verilog    asic/verilog
customlibs custom/oalibs

[target]
basepath #{getenv BASEPATH}

[quality]
0 untested
1 lightly tested
2 tested
3 full QA

[database]
location /tmp/datastore
location /tmp/#{getenv USER}/datashare

[pathmaps]
SHELF /tmp/#{getenv USER}/theshelf

[buildmethods]
customlibs make setup;make install

Modified datashare.scm from [4157f37338] to [ee9522478a].

231
232
233
234
235
236
237
238
239
240
241




















242
243
244
245
246
247
248
231
232
233
234
235
236
237




238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264







-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







(define (datashare:import-data source-path dest-path area version iteration)
  (let ((targ-path (conc dest-path "/" area "/" version "/" iteration)))
    (create-directory targ-path #t)
    (process-run "rsync" (list "-av" source-path targ-path))
    #t)) ;; #t on success

(define (datastore:get-best-storage configdat)
  (let ((store-areas (configf:get-section configdat "storage")))
    (print "store-areas:")
    (pp store-areas)
    (cadar store-areas)))
  (let* ((storage     (configf:lookup configdat "setup" "storage"))
	 (store-areas (if storage (string-split storage) '())))
    (datastore:find-most-space store-areas)))

(define (datastore:find-most-space paths)
  (fold (lambda (area res)
	  ;; (print "area=" area " res=" res)
	  (let ((maxspace (car res))
		(currpath (cdr res)))
	    ;; (print currpath " " maxspace)
	    (if (file-write-access? area)
		(let ((currspace (with-input-from-pipe 
				  (conc "df --output=avail " area)
				  (lambda ()(read)(read)))))
		  (if (> currspace maxspace) 
		      (cons currspace area)
		      res))
		res)))
	(cons 0 #f)
	paths))

;;======================================================================
;; GUI
;;======================================================================

;; The main menu 
(define (datashare:main-menu)
274
275
276
277
278
279
280
281

282
283
284
285
286
287
288
290
291
292
293
294
295
296

297
298
299
300
301
302
303
304







-
+







	 (component   (iup:listbox #:expand "HORIZONTAL" #:dropdown "YES" ))
	 (version-val (iup:textbox #:expand "HORIZONTAL" #:size "50x"))
	 ;; (copy-link   (iup:toggle  #:expand "HORIZONTAL"))
	 ;; (iteration   (iup:textbox #:expand "YES" #:size "20x"))
	 ;; (iteration   (iup:textbox #:expand "HORIZONTAL" #:size "20x"))
	 (comment-tb  (iup:textbox #:expand "YES" #:multiline "YES"))
	 (source-tb   (iup:textbox #:expand "HORIZONTAL"
				   #:value (or (configf:lookup configdat "target" "basepath")
				   #:value (or (configf:lookup configdat "settings" "basepath")
					       "")))
	 (publish     (lambda (publish-type)
			(let* ((area-num    (or (string->number (iup:attribute areas-sel "VALUE")) 0))
			       (area-dat    (if (> area-num 0)(list-ref areas (- area-num 1))'("NOT SELECTED" "NOT SELECTED")))
			       (area-path   (cadr area-dat))
			       (area-name   (car  area-dat))
			       (version     (iup:attribute version-tb "VALUE"))
341
342
343
344
345
346
347
348
349
350



351

352
353
354
355
356
357
358
359
360
361
362
363
364
365


























366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385

386
387










388
389
390
391
392
393
394
357
358
359
360
361
362
363

364
365
366
367
368

369
370
371
372
373
374
375
376
377
378
379
380
381


382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426

427
428

429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445







-


+
+
+
-
+












-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+



















-
+

-
+
+
+
+
+
+
+
+
+
+







   (iup:hbox
    (let* ((label-size     "60x")
	   (area-filter    "%")
	   (version-filter "%")
	   (iter-filter    ">= 0")
	   (dat            (make-hash-table)) ;; reverse lookup
	   (apply          (iup:button "Apply"))
	   (source         (iup:textbox))
	   (submitter      (iup:label "" #:expand "HORIZONTAL"))
	   (date-submitted (iup:label "" #:expand "HORIZONTAL"))
	   (comment        (iup:label "" #:expand "HORIZONTAL"))
	   (copy-link      (iup:label "" #:expand "HORIZONTAL"))
	   (quality        (iup:label "" #:expand "HORIZONTAL"))
	   (source-data    (iup:label "" #:expand "HORIZONTAL"))
	   ;; (source-data    (iup:label "" #:expand "HORIZONTAL"))
	   (tb             (iup:treebox
			    #:value 0
			    #:name "Packages"
			    #:expand "YES"
			    #:addexpanded "NO"
			    #:selection-cb
			    (lambda (obj id state)
			      ;; (print "obj: " obj ", id: " id ", state: " state)
			      (let* ((path   (datastore:lst->path (cdr (tree:node->path obj id))))
				     (record (hash-table-ref/default dat path #f)))
				(if record
				    (begin
				      (iup:attribute-set! submitter "TITLE" (datastore:pkg-get-submitter record))
				      (iup:attribute-set! date-submitted "TITLE" (time->string (seconds->local-time (datastore:pkg-get-datetime record))))))
				      (iup:attribute-set! submitter      "TITLE" (datastore:pkg-get-submitter record))
				      (iup:attribute-set! date-submitted "TITLE" (time->string (seconds->local-time (datastore:pkg-get-datetime record))))
				      (iup:attribute-set! comment        "TITLE" (datastore:pkg-get-comment record))
				      (iup:attribute-set! quality        "TITLE" (datastore:pkg-get-quality record))
				      (iup:attribute-set! copy-link      "TITLE" (datastore:pkg-get-store_type record))
				      ))
				(print  "id=" id " path=" path " record=" record);; (tree:node->path obj id) " run-id: " run-id)
				))))
	   (tb2             (iup:treebox
			    #:value 0
			    #:name "Packages"
			    #:expand "YES"
			    #:addexpanded "NO"
			    #:selection-cb
			    (lambda (obj id state)
			      ;; (print "obj: " obj ", id: " id ", state: " state)
			      (let* ((path   (datastore:lst->path (cdr (tree:node->path obj id))))
				     (record (hash-table-ref/default dat path #f)))
				(if record
				    (begin
				      (iup:attribute-set! submitter      "TITLE" (datastore:pkg-get-submitter record))
				      (iup:attribute-set! date-submitted "TITLE" (time->string (seconds->local-time (datastore:pkg-get-datetime record))))
				      (iup:attribute-set! comment        "TITLE" (datastore:pkg-get-comment record))
				      (iup:attribute-set! quality        "TITLE" (datastore:pkg-get-quality record))
				      (iup:attribute-set! copy-link      "TITLE" (datastore:pkg-get-store_type record))
				      ))
				(print  "id=" id " path=" path " record=" record);; (tree:node->path obj id) " run-id: " run-id)
				))))
	   (refresh        (lambda (obj)
			     (let ((db (datashare:open-db configdat)))
			       (for-each
				(lambda (pkgitem)
				  (let* ((pkg-path   (list (datastore:pkg-get-area  pkgitem)
							   (datastore:pkg-get-version_name pkgitem)
							   (datastore:pkg-get-iteration pkgitem)))
					 (pkg-id     (datastore:pkg-get-id          pkgitem))
					 (path       (datastore:lst->path pkg-path)))
				    ;; (print "tree:add-node tb=" tb ", pkg-path=" pkg-path ", pkg-id=" pkg-id)
				    (if (not (hash-table-ref/default dat path #f))
					(tree:add-node tb "Packages" pkg-path userdata: (conc "pkg-id: " pkg-id)))
				    ;; (print "path=" path " pkgitem=" pkgitem)
				    (hash-table-set! dat path pkgitem)))
				(datashare:get-pkgs db area-filter version-filter iter-filter))
			       (sqlite3:finalize! db)))))
      (iup:vbox 
       tb 
       (iup:hbox tb tb2)
       (iup:hbox (iup:button "Refresh" #:action refresh) apply)
       (iup:hbox (iup:label "Submitter:" #:size label-size)(iup:hbox submitter)(iup:label "Date submitted:" #:size label-size))
       (iup:hbox (iup:label "Submitter: ") ;;  #:size label-size)
		 submitter 
		 (iup:label "Submitted on: ") ;;  #:size label-size)
		 date-submitted)
       (iup:hbox (iup:label "Data stored: ")
		 copy-link
		 (iup:label "Quality: ")
		 quality)
       (iup:hbox (iup:label "Comment: ")
		 comment)
       )))))

(define (datashare:manage-view configdat)
  (iup:vbox
   (iup:hbox 
    (iup:button "Pushme"
		#:expand "YES"