This commit is contained in:
Nicholas Koben Kao 2024-01-24 12:53:43 -08:00
parent b1e9bcc4e6
commit eb04f246a4
4 changed files with 12 additions and 3 deletions

View File

@ -2,6 +2,7 @@ import modal
from config import config from config import config
import os import os
import subprocess import subprocess
from pprint import pprint
stub = modal.Stub() stub = modal.Stub()
@ -51,6 +52,8 @@ def download_model(volume_name, download_config):
status = {"status": "success"} status = {"status": "success"}
requests.post(callback_url, json={**status, **callback_body}) requests.post(callback_url, json={**status, **callback_body})
print(f"finished! sending to {callback_url}")
pprint({**status, **callback_body})
@stub.local_entrypoint() @stub.local_entrypoint()
@ -63,7 +66,11 @@ def simple_download():
except modal.exception.FunctionTimeoutError as e: except modal.exception.FunctionTimeoutError as e:
status = {"status": "failed", "error_logs": f"{str(e)}", "timeout": timeout} status = {"status": "failed", "error_logs": f"{str(e)}", "timeout": timeout}
requests.post(callback_url, json={**status, **callback_body}) requests.post(callback_url, json={**status, **callback_body})
print(f"finished! sending to {callback_url}")
pprint({**status, **callback_body})
except Exception as e: except Exception as e:
status = {"status": "failed", "error_logs": str(e)} status = {"status": "failed", "error_logs": str(e)}
requests.post(callback_url, json={**status, **callback_body}) requests.post(callback_url, json={**status, **callback_body})
print(f"finished! sending to {callback_url}")
pprint({**status, **callback_body})

View File

@ -19,6 +19,7 @@ export async function POST(request: Request) {
if (!data || error) return error; if (!data || error) return error;
const { checkpoint_id, error_log, status, folder_path } = data; const { checkpoint_id, error_log, status, folder_path } = data;
console.log( checkpoint_id, error_log, status, folder_path )
if (status === "success") { if (status === "success") {
await db await db

View File

@ -89,7 +89,7 @@ export const columns: ColumnDef<CheckpointItemList>[] = [
</span> </span>
{checkpoint.is_public ? ( {checkpoint.is_public ? (
<Badge variant="orange">Public</Badge> <Badge variant="green">Public</Badge>
) : ( ) : (
<Badge variant="orange">Private</Badge> <Badge variant="orange">Private</Badge>
)} )}
@ -112,7 +112,7 @@ export const columns: ColumnDef<CheckpointItemList>[] = [
}, },
cell: ({ row }) => { cell: ({ row }) => {
return ( return (
<Badge variant={row.original.status === "failed" ? "red" : "green"}> <Badge variant={row.original.status === "failed" ? "red" : (row.original.status === "started" ? "yellow" : "green")}>
{row.original.status} {row.original.status}
</Badge> </Badge>
); );

View File

@ -115,6 +115,7 @@ function getUrl(civitai_url: string) {
export const addCivitaiCheckpoint = withServerPromise( export const addCivitaiCheckpoint = withServerPromise(
async (data: z.infer<typeof addCivitaiCheckpointSchema>) => { async (data: z.infer<typeof addCivitaiCheckpointSchema>) => {
const { userId, orgId } = auth(); const { userId, orgId } = auth();
console.log("START")
console.log("1"); console.log("1");
if (!data.civitai_url) return { error: "no civitai_url" }; if (!data.civitai_url) return { error: "no civitai_url" };
@ -221,7 +222,7 @@ async function uploadCheckpoint(
volume_name: v.volume_name, volume_name: v.volume_name,
volume_id: v.id, volume_id: v.id,
checkpoint_id: c.id, checkpoint_id: c.id,
callback_url: `${protocol}://${domain}/api/volume-updated`, callback_url: `${protocol}://${domain}/api/volume-upload`,
upload_type: "checkpoint" upload_type: "checkpoint"
}), }),
}, },