mirror of
https://github.com/vale981/emacs-ipython-notebook
synced 2025-03-05 17:11:41 -05:00
more request-curl callback protections
This commit is contained in:
parent
7a6d3c072b
commit
16cb32a1a6
5 changed files with 25 additions and 15 deletions
|
@ -204,15 +204,15 @@ build: off
|
|||
# - [DAL, BL] # 2nd job
|
||||
|
||||
# scripts to run before tests (working directory and environment changes are persisted from the previous steps such as "before_build")
|
||||
before_test:
|
||||
#before_test:
|
||||
|
||||
# to run your custom scripts instead of automatic tests
|
||||
test_script:
|
||||
- cd c:\projects\myproject
|
||||
#test_script:
|
||||
# - cd c:\projects\myproject
|
||||
# - make quick
|
||||
|
||||
# scripts to run after tests
|
||||
after_test:
|
||||
#after_test:
|
||||
|
||||
# to disable automatic tests
|
||||
test: off
|
||||
|
@ -233,4 +233,4 @@ deploy: off
|
|||
|
||||
# after build failure or success
|
||||
on_finish:
|
||||
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
|
||||
- ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
|
||||
|
|
|
@ -90,9 +90,9 @@ global setting. For global setting and more information, see
|
|||
(ein:log 'debug "ein:query-contents--complete %s" resp-string))
|
||||
|
||||
(defun* ein:content-query-contents--error (url-or-port path callback iteration &key symbol-status response error-thrown &allow-other-keys)
|
||||
(if (and (eq (request-response-status-code response) 403) (< iteration 3))
|
||||
(if (< iteration 3)
|
||||
(progn
|
||||
(ein:log 'info "Retry content-query-contents #%s" iteration)
|
||||
(ein:log 'info "Retry content-query-contents #%s in response to %s" iteration (request-response-status-code response))
|
||||
(ein:content-query-contents url-or-port path callback (1+ iteration)))
|
||||
(ein:log 'error "ein:content-query-contents--error %s REQUEST-STATUS %s DATA %s" (concat (file-name-as-directory url-or-port) path) symbol-status (cdr error-thrown))))
|
||||
|
||||
|
@ -346,8 +346,10 @@ global setting. For global setting and more information, see
|
|||
;;; Sessions
|
||||
|
||||
|
||||
(defun ein:content-query-sessions (url-or-port callback)
|
||||
(defun ein:content-query-sessions (url-or-port callback &optional iteration)
|
||||
"Register CALLBACK of arity 1 to retrieve the sessions"
|
||||
(unless iteration
|
||||
(setq iteration 0))
|
||||
(ein:query-singleton-ajax
|
||||
(list 'content-query-sessions url-or-port)
|
||||
(ein:url url-or-port "api/sessions")
|
||||
|
@ -355,7 +357,7 @@ global setting. For global setting and more information, see
|
|||
:parser #'ein:json-read
|
||||
:complete (apply-partially #'ein:content-query-sessions--complete url-or-port callback)
|
||||
:success (apply-partially #'ein:content-query-sessions--success url-or-port callback)
|
||||
:error (apply-partially #'ein:content-query-sessions--error url-or-port)
|
||||
:error (apply-partially #'ein:content-query-sessions--error url-or-port callback iteration)
|
||||
:sync ein:force-sync))
|
||||
|
||||
(defun* ein:content-query-sessions--success (url-or-port callback &key data &allow-other-keys)
|
||||
|
@ -370,8 +372,14 @@ global setting. For global setting and more information, see
|
|||
(setf (gethash (read-name (plist-get s :notebook)) session-hash)
|
||||
(cons (plist-get s :id) (plist-get s :kernel)))))))
|
||||
|
||||
(defun* ein:content-query-sessions--error (url-or-port &key error-thrown &allow-other-keys)
|
||||
(ein:log 'error "ein:content-query-sessions--error %s: ERROR %s DATA %s" url-or-port (car error-thrown) (cdr error-thrown)))
|
||||
(defun* ein:content-query-sessions--error (url-or-port callback iteration
|
||||
&key response error-thrown
|
||||
&allow-other-keys)
|
||||
(if (< iteration 3)
|
||||
(progn
|
||||
(ein:log 'info "Retry sessions #%s in response to %s" iteration (request-response-status-code response))
|
||||
(ein:content-query-sessions url-or-port callback (1+ iteration)))
|
||||
(ein:log 'error "ein:content-query-sessions--error %s: ERROR %s DATA %s" url-or-port (car error-thrown) (cdr error-thrown))))
|
||||
|
||||
(defun* ein:content-query-sessions--complete (url-or-port callback
|
||||
&key data response
|
||||
|
|
|
@ -186,9 +186,9 @@ the source is in git repository."
|
|||
(defun* ein:query-kernelspecs--error (url-or-port callback iteration
|
||||
&key response error-thrown
|
||||
&allow-other-keys)
|
||||
(if (and (eq (request-response-status-code response) 403) (< iteration 3))
|
||||
(if (< iteration 3)
|
||||
(progn
|
||||
(ein:log 'info "Retry kernelspecs #%s" iteration)
|
||||
(ein:log 'info "Retry kernelspecs #%s in response to %s" iteration (request-response-status-code response))
|
||||
(ein:query-kernelspecs url-or-port callback (1+ iteration)))
|
||||
(ein:log 'error
|
||||
"ein:query-kernelspecs-error %s: ERROR %s DATA %s" url-or-port (car error-thrown) (cdr error-thrown))))
|
||||
|
|
|
@ -499,7 +499,7 @@ Show full traceback in traceback viewer.
|
|||
;;;;;; "ein-python.el" "ein-pytools.el" "ein-query.el" "ein-scratchsheet.el"
|
||||
;;;;;; "ein-skewer.el" "ein-smartrep.el" "ein-subpackages.el" "ein-timestamp.el"
|
||||
;;;;;; "ein-utils.el" "ein-websocket.el" "ein-worksheet.el" "ein.el"
|
||||
;;;;;; "ob-ein.el" "zeroein.el") (23499 16469 728162 481000))
|
||||
;;;;;; "ob-ein.el" "zeroein.el") (23499 54796 72693 801000))
|
||||
|
||||
;;;***
|
||||
|
||||
|
|
|
@ -196,6 +196,7 @@ See the definition of `create-image' for how it works."
|
|||
(should (search-forward-regexp "^Hello$" nil t))))))
|
||||
|
||||
(ert-deftest 14-notebook-execute-current-cell-question ()
|
||||
:expected-result (if (eq system-type 'darwin) t :passed)
|
||||
(let ((notebook (ein:testing-get-untitled0-or-create *ein:testing-port*)))
|
||||
(ein:testing-wait-until
|
||||
(lambda () (ein:aand (ein:$notebook-kernel notebook)
|
||||
|
@ -205,7 +206,8 @@ See the definition of `create-image' for how it works."
|
|||
(insert "range?")
|
||||
(let ((cell (call-interactively #'ein:worksheet-execute-cell)))
|
||||
(ein:testing-wait-until (lambda () (and (not (oref cell :running))
|
||||
(ein:$notebook-pager notebook)))))
|
||||
(ein:$notebook-pager notebook)
|
||||
(get-buffer (ein:$notebook-pager notebook))))))
|
||||
(with-current-buffer (get-buffer (ein:$notebook-pager notebook))
|
||||
(should (search-forward "Docstring:"))))))
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue