Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved error reporting in netlify ci runner. #15

Merged
merged 8 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,28 @@
```mermaid
stateDiagram-v2
User --> Client
Upload --> CI
Upload --> ZipFile
ZipFile --> PresignedURL
ZipFile --> PresignedURL_Zip
CreateStatus --> status.json
status.json --> Status
Unzip --> FileSet
CreateTritonModel --> TritonModel
TestTritonModel --> BioEngineRunner
TritonModel --> BioEngineRunner
Publish --> PublishedFileSet
PresignedURL_Zip --> Unzip


state Client {
Add --> Edit
Edit --> Verify
Verify --> Upload
Upload --> PresignedURL
PresignedURL --> Status
PresignedURL_Zip
Status
}

state CI{
CreateStatus --> Unzip
CreateStatus
Unzip --> TestModel
TestModel --> CreateTritonModel
CreateTritonModel --> TestTritonModel
Expand All @@ -48,6 +49,7 @@ stateDiagram-v2
state Zenodo {
PublishedFileSet
}

```


Expand Down
19 changes: 14 additions & 5 deletions functions/notify_ci.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,13 @@ const headers = {
// 'user-agent': 'bioimage-bot'

export default async (event, context) => {
//const data = await JSON.parse(event.body)

const data = await event.json();
const options = {
method: "POST",
headers: headers,
body: JSON.stringify({
'ref': 'staging',
'inputs':{
//'status_url': data.status_url,
'model_nickname': data.model_nickname,
}
})
Expand All @@ -40,8 +37,20 @@ export default async (event, context) => {
let resp = await fetch(GITHUB_URL, options);
try{
resp_obj = await resp.json();
}catch(err){
console.log("No JSON in response");
}catch{
console.log("No JSON in response from");
let text = "";
try{
text = await resp.text()
}catch{
text = "FAILED TO GET RESPONSE TEXT";
}
const res = Response.json(
{'message': `Failed to decode json from CI [repsonse-text: ${text}]`},
{status: 500});
res.headers.set("Access-Control-Allow-Origin", "*");
res.headers.append("Access-Control-Allow-Headers", "*");
res.headers.append("Access-Control-Allow-Methods", "*");
}

}catch(err){
Expand Down
18 changes: 18 additions & 0 deletions src/components/Modal.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<script>
export let show=false;

</script>
{#if show}
<dialog open={show}>
<article>
<slot />

<footer>
<button on:click={()=>{show=false;}}>Close</button>
</footer>
</article>
</dialog>
{/if}



6 changes: 3 additions & 3 deletions src/components/Status.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
if(status_step > 0){
//value = `{status_step}`;
console.log(value);
value = `{status_step}`;
max = `{status_num_steps}`;
value = `${status_step}`;
max = `${status_num_steps}`;
console.log("value and max");
console.log(value);
console.log(max);
Expand Down Expand Up @@ -77,7 +77,7 @@
{/if}
{:else}
<SingleLineInputs>
<input bind:value={input_value} placeholder="Enter model name, e.g. affable-shark"/>
<input type="text" bind:value={input_value} placeholder="Enter model name, e.g. affable-shark"/>
<button class="icon" on:click={()=>set_model_name(input_value)} ><Search /></button>
</SingleLineInputs>
{/if}
1 change: 0 additions & 1 deletion src/components/Uploader/Add.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import Dropzone from "svelte-file-dropzone/Dropzone.svelte";
import toast from 'svelte-french-toast';
import { createEventDispatcher } from 'svelte';
import Uploader from './index.js';
import ButtonWithConfirmation from './ButtonWithConfirmation.svelte';

export let uploader;
Expand Down
2 changes: 1 addition & 1 deletion src/components/Uploader/UploadStatus.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

<p><b>There's nothing you need to do right now. Your model is uploaded and the CI-bots have started their work!</b><p>
<!--<FullScreenConfetti /> -->
<p>You can check the status of the CI at any point from <a href="/status/{uploader.model_nickname.name}">here</a></p>
<p>You can check the status of the CI at any point from <a href="#/status/{uploader.model_nickname.name}">here</a></p>
{:else}
{#if uploading}
<p>Uploading</p>
Expand Down
27 changes: 22 additions & 5 deletions src/components/Uploader/index.svelte
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
<script>
import toast, { Toaster } from 'svelte-french-toast';

import Uploader from './index.js';
import Uploader from '../../lib/uploader.js';

import Modal from '../Modal.svelte';
import Nav from './Nav.svelte';
import Add from './Add.svelte';
import Edit from './Edit.svelte';
import Review from './Review.svelte';
import UploadStatus from './UploadStatus.svelte';
import Notification from './Notification.svelte';

let show_modal = false;

let uploader = new Uploader();
uploader.show_login_window = (url) => {
console.log("Should be showing the following in a dialog");
console.log(url);
show_modal = true;
}
let step = "add";
let rerender = false;

Expand All @@ -22,20 +30,29 @@
uploader.reset();
}

console.log("Uploader in window for live inspection");
window.uploader = uploader;
if((uploader.token && !uploader.server)) uploader.init();

</script>

<Toaster />

{#key rerender}
{#if !uploader.token}
<Notification deletable={false} >
<!--{#if router.location.hash === "review" }-->
<p>You must now login to publish</p>
<!--<p>You must now login to publish</p>-->
<!--{/if}-->
{#if uploader.login_url}
<button on:click={()=>{window.open(uploader.login_url, '_blank')}}>Login to BioEngine</button>
<!--<button on:click={()=>{uploader.init();}}>Login to BioEngine</button>-->
<Modal show={show_modal} >
<h1>Login</h1>
<iframe title="Login" src="{uploader.login_url}" width="400" height="400"></iframe>
</Modal>

{:else}
<span aria-busy="true">Connecting to the BioEngine...</span>
<!--<span aria-busy="true">Connecting to the BioEngine...</span>-->
<button on:click={()=>{uploader.init();}}>Login to BioEngine</button>
{/if}
</Notification>
{:else if !uploader.server}
Expand Down
Empty file removed src/lib/imjoy-rpc-hypha/index.js
Empty file.
Loading