-
-
- Welcome
-
- Welcome to the BEE Viz. Use the form below to connect to BEE and
- view a running workflow.
-
- " + name + " " + task_status + "
"; - taskList.appendChild(newTask); - } -} - -// Set the current workflow -function set_current_workflow(workflow) { - (async () => { - currentWorkflow = workflow; - let current_wf_status = document.getElementById('current-wf_status'); - let current_wf_resource = document.getElementById('current-wf_resource'); - let current_wf_name = document.getElementById('current-wf_name'); - let current_wf_id = document.getElementById('current-wf_id'); - - // Modify the variables used for the current workflow - current_wf_status.innerHTML = workflow.status; - current_wf_resource.innerHTML = 'fg-rfe1'; - current_wf_name.innerHTML = workflow.name; - current_wf_id.innerHTML = workflow.id; - - // Need to add some additional logic here and make this truly asynchronous - let {wf_status, tasks} = await client.query_workflow(workflow.id); - - // Set visualiation - document.getElementById('viz').src = "viz.html"; - current_wf_status.innerHTML = wf_status; - taskList = document.getElementById('taskList'); - taskList.innerHTML = ''; - - for (task_id in tasks) { - let name = tasks[task_id]['name']; - let base_command = tasks[task_id]['command']; - let task_status = tasks[task_id]['status']; - var newTask = document.createElement('li'); - newTask.innerHTML = "" + name + " " + task_status + "
"; - taskList.appendChild(newTask); - } - })(); -} - -function download_current_archive() { - wf_id = currentWorkflow.id; - client.download_archive(wf_id); - console.log(wf_id) -} - -function update_current_workflow() { - (async () => { - // Query status of tasks - wf_id = currentWorkflow.id; - let {wf_status, tasks} = await client.query_workflow(wf_id); - - // Update visualization - document.getElementById('viz').contentWindow.location.reload(); - let current_wf_status = document.getElementById('current-wf_status'); - current_wf_status.innerHTML = wf_status; - - taskList = document.getElementById('taskList'); - taskList.innerHTML = ''; - - for (task_id in tasks) { - let name = tasks[task_id]['name'] - let base_command = tasks[task_id]['command'] - let task_status = tasks[task_id]['status'] - var newTask = document.createElement('li'); - newTask.innerHTML = "" + name + " " + task_status + "
"; - taskList.appendChild(newTask) - } - })(); -} - -// Set the things we want to export -module.exports = { initialize, workflows, add_workflow, start_workflow, - update_current_workflow, Workflow, have_workflows, - pause_workflow, resume_workflow, delete_workflow, workflows, - download_current_archive, reexecute_workflow } diff --git a/beeflow/remote/remote.py b/beeflow/remote/remote.py new file mode 100644 index 000000000..70cc6cf09 --- /dev/null +++ b/beeflow/remote/remote.py @@ -0,0 +1,161 @@ +"""This script manages an API that allows the remote submission of jobs.""" +import os +import socket +import pathlib +from fastapi import FastAPI +import uvicorn + +from beeflow.common import cli_connection +from beeflow.common import paths +from beeflow.client import bee_client +from beeflow.common.config_driver import BeeConfig as bc + + +app = FastAPI() + + +@app.get("/") +def read_root(): + """Get REST Connection info.""" + return {"Endpoint info": "BEEflow core API: Documentation - https://lanl.github.io/BEE/"} + + +@app.get("/workflows/status/") +def get_wf_status(): + """WIP - This endpoint is planned to give you a status on an actively running workflow.""" + + +@app.get("/droppoint") +def get_drop_point(): + """Transmit the scp location to be used for the storage of workflow tarballs. + + Users are required to ensure that this directory has the appropriate permissions. + """ + output = {} + output["droppoint"] = str(paths.droppoint_root()) + return output + + +@app.get("/owner") +def get_owner(): + """Transmit the owner of this BEEflow instance.""" + user_name = os.getenv('USER') or os.getenv('USERNAME') + return user_name + + +@app.get("/submit/{filename}") +def submit_new_wf(filename: str): + """WIP: Submit a new workflow with a tarball for the workflow at a given path.""" + return filename + + +@app.get("/submit_long/{wf_name}/{tarball_name}/{main_cwl_file}/{job_file}") +def submit_new_wf_long(wf_name: str, tarball_name: str, main_cwl_file: str, job_file: str): + r"""Submit a new workflow with a tarball for the workflow at a given path. + + This makes the following assumptions:\n + The workflow tarball should be at