Megatest

Diff
Login

Differences From Artifact [9d235648e1]:

To Artifact [3c7c56e5e8]:


3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
  (mutex-lock! *homehost-mutex*)
  (cond
   (*home-host*
    (mutex-unlock! *homehost-mutex*)
    *home-host*)
   ((not *toppath*)
    (mutex-unlock! *homehost-mutex*)
    ((launch:setup) ;; safely mutexed now
     (if (> trynum 0)
	 (begin
	   (thread-sleep! 2)
	   (common:get-homehost trynum: (- trynum 1)))
	 #f))
    (else
     (let* ((currhost (get-host-name))
	    (bestadrs (server:get-best-guess-address currhost))
	    ;; first look in config, then look in file .homehost, create it if not found
	    (homehost (or (configf:lookup *configdat* "server" "homehost" )
			  (handle-exceptions
			   exn
			   (if (> trynum 0)
			       (let ((delay-time (* (- 5 trynum) 5)))
				 (mutex-unlock! *homehost-mutex*)
				 (debug:print 0 *default-log-port* "ERROR: ["(common:human-time)"] Failed to read .homehost file, delaying "
					      delay-time " seconds and trying again, message: "  ((condition-property-accessor 'exn 'message) exn)
					      ", exn=" exn)
				 (thread-sleep! delay-time)
				 (common:get-homehost trynum: (- trynum 1)))
			       (begin
				 (mutex-unlock! *homehost-mutex*)
				 (debug:print 0 *default-log-port* "ERROR: ["(common:human-time)
					      "] Failed to read .homehost file after trying five times. Giving up and exiting, message: "
					      ((condition-property-accessor 'exn 'message) exn))
				 ;;======================================================================
				 (exit 1)))
			   (let ((hhf (conc *toppath* "/.homehost")))
			     (if (common:file-exists? hhf)
				 (with-input-from-file hhf read-line)
				 (if (file-write-access? *toppath*)
				     (begin
				       (with-output-to-file hhf
					 (lambda ()
					   (print bestadrs)))
				       (begin
					 (mutex-unlock! *homehost-mutex*)
					 (car (common:get-homehost))))
				     #f))))))
	    (at-home  (or (equal? homehost currhost)
			  (equal? homehost bestadrs))))
       (set! *home-host* (cons homehost at-home))
       (mutex-unlock! *homehost-mutex*)
       *home-host*)))))

(define (common:wait-for-homehost-load maxnormload msg)
  (let* ((hh-dat (if (common:on-homehost?) ;; if we are on the homehost then pass in #f so the calls are local.
		     #f
		     (common:get-homehost)))
	 (hh     (if hh-dat (car hh-dat) #f)))
    (common:wait-for-normalized-load maxnormload msg hh)))







|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|







3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893

3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
  (mutex-lock! *homehost-mutex*)
  (cond
   (*home-host*
    (mutex-unlock! *homehost-mutex*)
    *home-host*)
   ((not *toppath*)
    (mutex-unlock! *homehost-mutex*)
    (launch:setup) ;; safely mutexed now
    (if (> trynum 0)
	(begin
	  (thread-sleep! 2)
	  (common:get-homehost trynum: (- trynum 1)))
	#f))
   (else
    (let* ((currhost (get-host-name))
	   (bestadrs (server:get-best-guess-address currhost))
	   ;; first look in config, then look in file .homehost, create it if not found
	   (homehost (or (configf:lookup *configdat* "server" "homehost" )
			 (handle-exceptions
			  exn
			  (if (> trynum 0)
			      (let ((delay-time (* (- 5 trynum) 5)))
				(mutex-unlock! *homehost-mutex*)
				(debug:print 0 *default-log-port* "ERROR: ["(common:human-time)"] Failed to read .homehost file, delaying "
					     delay-time " seconds and trying again, message: "  ((condition-property-accessor 'exn 'message) exn)
					     ", exn=" exn)
				(thread-sleep! delay-time)
				(common:get-homehost trynum: (- trynum 1)))
			      (begin
				(mutex-unlock! *homehost-mutex*)
				(debug:print 0 *default-log-port* "ERROR: ["(common:human-time)
					     "] Failed to read .homehost file after trying five times. Giving up and exiting, message: "
					     ((condition-property-accessor 'exn 'message) exn))

				(exit 1)))
			  (let ((hhf (conc *toppath* "/.homehost")))
			    (if (common:file-exists? hhf)
				(with-input-from-file hhf read-line)
				(if (file-write-access? *toppath*)
				    (begin
				      (with-output-to-file hhf
					(lambda ()
					  (print bestadrs)))
				      (begin
					(mutex-unlock! *homehost-mutex*)
					(car (common:get-homehost))))
				    #f))))))
	   (at-home  (or (equal? homehost currhost)
			 (equal? homehost bestadrs))))
      (set! *home-host* (cons homehost at-home))
      (mutex-unlock! *homehost-mutex*)
      *home-host*))))

(define (common:wait-for-homehost-load maxnormload msg)
  (let* ((hh-dat (if (common:on-homehost?) ;; if we are on the homehost then pass in #f so the calls are local.
		     #f
		     (common:get-homehost)))
	 (hh     (if hh-dat (car hh-dat) #f)))
    (common:wait-for-normalized-load maxnormload msg hh)))