Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
7503ae3
EBR-159: add test components for vbi library
915-Misan-Teodora Sep 25, 2025
95db8a5
EBR-159: refactor components
915-Misan-Teodora Sep 26, 2025
74d5662
EBR-159: remove unused components, add todos/questions
915-Misan-Teodora Oct 14, 2025
c81fe1a
EBR-159: add mpr model and small refactor
915-Misan-Teodora Oct 30, 2025
5984cfc
EBR-173: add cache for vbi components and add a viewer for plotting t…
915-Misan-Teodora Dec 11, 2025
d8e4dd2
EBR-159: refactor code
915-Misan-Teodora Dec 15, 2025
a5b1e02
EBR-173: add missing dependency
915-Misan-Teodora Dec 15, 2025
2ec6228
EBR-173: refactor code
915-Misan-Teodora Dec 15, 2025
f5c9b64
EBR-159: fix sonar issues
915-Misan-Teodora Dec 15, 2025
d2e9c8d
EBR-159: cleanup
915-Misan-Teodora Dec 17, 2025
11770df
EBR-176: refactor open viewer functionality for plotting the samples
915-Misan-Teodora Jan 16, 2026
b04d400
EBR-162: add timeseries viewer for vbi simulation runner
915-Misan-Teodora Jan 22, 2026
a2338a7
EBR-162: small refactor
915-Misan-Teodora Jan 23, 2026
862a586
EBR-163: refactor simulator code for handling cpp models
915-Misan-Teodora Jan 29, 2026
ab0e1d8
EBR-163: modify the timeseries viewer notebook for cpp/numba models
915-Misan-Teodora Jan 29, 2026
ffaf01b
EBR-159: add component information for config inference and refactor …
915-Misan-Teodora Jan 29, 2026
280a896
EBR-159: add component information for the other vbi components
915-Misan-Teodora Feb 5, 2026
6d837d7
EBR-159: update inferenceworkflow xircuits file
915-Misan-Teodora Feb 9, 2026
70c1923
EBR-159: add two new models
915-Misan-Teodora Feb 10, 2026
3bcda37
EBR-159: small refactor
915-Misan-Teodora Feb 10, 2026
9db9c09
EBR-159: resolve sonarqube issues
915-Misan-Teodora Feb 10, 2026
ca3b066
EBR-159: fix sonarqube issue
915-Misan-Teodora Feb 10, 2026
0b96d20
EBR-159: add info text for vbi models
915-Misan-Teodora Feb 11, 2026
0d61943
EBR-159: resolve invalid syntax error in remote run command
915-Misan-Teodora Feb 11, 2026
50d0cd9
EBR-159: switch to json5 for parsing settings comments and prepare ve…
915-Misan-Teodora Feb 11, 2026
963ac08
EBR-159: rename jupyterlab user settings
915-Misan-Teodora Feb 12, 2026
d1f8ce1
EBR-159: replace print with logger
915-Misan-Teodora Feb 17, 2026
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
14 changes: 6 additions & 8 deletions docker/Dockerfile-hpc
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ ARG ENV_BIN=/opt/conda/envs/tvb-run/bin
ARG PIP=$ENV_BIN/pip

USER root
RUN cd tvb-root; \
cd tvb_bin; \
$PIP install -e .

RUN $PIP install tvb-library==2.6
WORKDIR /tvb-root/tvb_bin
RUN "$PIP" install -e . && \
"$PIP" install tvb-library==2.6
# RUN $PIP install tvb-ext-xircuits

WORKDIR /home
Expand All @@ -17,9 +15,9 @@ ARG LAST_SHA=LATEST

ARG JUPYTER=$ENV_BIN/jupyter

RUN cd tvb-ext-xircuits; \
git pull; \
$PIP install -e .
WORKDIR /home/tvb-ext-xircuits
RUN git pull; \
"$PIP" install -e .

# $JUPYTER labextension develop . --overwrite; \
# $JUPYTER server extension enable xircuits
Expand Down
3,333 changes: 3,333 additions & 0 deletions examples/InferenceWorkflow.xircuits

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tvb-ext-xircuits",
"version": "2.1.3",
"version": "3.0.0",
"description": "Jupyterlab extension for building TVB workflows in a visual and interactive manner",
"keywords": [
"jupyter",
Expand Down
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ dependencies = [
"importlib_resources",
"asgiref",
"dill",
"joblib",
"json5"
]
dynamic = ["version", "description", "authors", "urls", "keywords"]

Expand All @@ -66,6 +68,9 @@ full = [
"tvb-gdist",
"tvb-framework",
"tvb-widgets>=1.0",
"vbi[inference]",
"torch",
"sbi"
]

[tool.hatch.version]
Expand Down
4 changes: 2 additions & 2 deletions schema/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"title": "Base Directory Setting",
"description": "Setting to define the base directory.",
"title": "tvb-ext-xircuits",
"description": "tvb-ext-xircuits extension settings.",
"type": "object",
"properties": {
"baseDirectoryWeb": {
Expand Down
6 changes: 4 additions & 2 deletions src/commands/NodeActionCommands.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,15 @@ export function addNodeActionCommands(
})
return;
}

let xircuits_filename = tracker.currentWidget.context.path;
xircuits_filename = xircuits_filename.split('/').pop().replace('.xircuits', '');
const dataToSend = {
'component': node.name,
'component_id': node.options.id,
'component_inputs': gatherNodeInPortValues(node),
'path': node.extras.path,
'xircuits_id': node.parent.parent.options.id
'xircuits_id': node.parent.parent.options.id,
'xircuits_filename': xircuits_filename
};

const response = await requestAPI<any>('components/', {
Expand Down
8 changes: 3 additions & 5 deletions src/components/XircuitsBodyWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -693,17 +693,15 @@ export const BodyWidget: FC<BodyWidgetProps> = ({
// Run Mode
context.ready.then(async () => {
const workflow_path = context.path;
let model_path = workflow_path.split(".xircuits")[0] + ".py";
const model_path = workflow_path.split(".xircuits")[0] + ".py";
let code = startRunOutputStr();

let result;

// Convert the model_path to be bash aware
model_path = `"${model_path}"`;

if (runType == 'run') {
result = await handleLocalRunDialog();
if (result.status === 'ok') {
code += `%run ${model_path} ${result.args}`;
code += `%run "${model_path}" ${result.args}`;
commands.execute(commandIDs.executeToOutputPanel, { code });
}
else if (result.status === 'cancelled') {
Expand Down
29 changes: 17 additions & 12 deletions src/components/runner/RemoteRun.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,28 @@ export function buildRemoteRunCommand(path: string, config: { formattedCommand:
'$XIRCUITS_PATH': path
};

let command_str = command + " " + path + " " + config['run_config_name']
+ " " + config['project']
+ " " + config['stage_out']
+ " " + config['filesystem']
+ " " + config['envName']
+ " " + config['python']
+ " " + config['modules']
+ " " + config['libraries'];
let args = [
...command.trim().split(/\s+/),
path,
config['run_config_name'],
config['project'],
config['stage_out'],
config['filesystem'],
config['envName'],
config['python'],
config['modules'],
config['libraries']];
Object.keys(envVariables).forEach(key => {
command_str = command_str.replace(new RegExp(`\\${key}`, 'g'), envVariables[key]);
args = args.map(arg =>
arg.replace(new RegExp(`\\${key}`, 'g'), envVariables[key])
);
});

let code_str = "\nfrom subprocess import Popen, PIPE\n\n";
code_str += `command_str= "${command_str}"\n`;
code_str += "p=Popen(command_str, stdout=PIPE, stderr=PIPE, universal_newlines=True, shell=True)\n";
code_str += `args= ${JSON.stringify(args)}\n`;
code_str += "p=Popen(args, stdout=PIPE, stderr=PIPE, universal_newlines=True, shell=False)\n";
code_str += "print('Remote Execution Run Mode.\\n')\n";
code_str += `print(f'[COMMAND]\\n{command_str}\\n')\n`;
code_str += `print(f'[COMMAND]\\n{args}\\n')\n`;

if (config.url) {
code_str += `print('[URL]\\nPlease go to ${config.url} for more details\\n')\n`;
Expand Down
11 changes: 6 additions & 5 deletions tvbextxircuits/compiler/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def generate(self, filelike):
self._generate_component_imports(),
self._generate_flows(flow_name),
self._generate_main(flow_name),
self._generate_trailer()
self._generate_trailer(flow_name)
))

with open(filelike.name, 'w', encoding='utf-8') as f:
Expand Down Expand Up @@ -356,20 +356,20 @@ def _build_node_set(self):
node_queue.append(port.source)
return nodes

def _generate_trailer(self):
def _generate_trailer(self, flow_name):
code = """
if __name__ == '__main__':
args, _ = parser.parse_known_args()
main(args)
print("\\nFinished Executing")
"""
body = ast.parse(code).body[0]
arg_parsing = self._generate_argument_parsing()
arg_parsing = self._generate_argument_parsing(flow_name=flow_name)
arg_parsing.extend(body.body)
body.body = arg_parsing
return [body]

def _generate_argument_parsing(self):
def _generate_argument_parsing(self, flow_name):
# Unfortunately, we don't have the information anywhere else and updating the file format isn't an option at the moment
pattern = re.compile(r'^Argument \(.+?\): (.+)$')

Expand All @@ -381,9 +381,10 @@ def _generate_argument_parsing(self):
"any": "any"
}

code = """
code = f"""
parser = ArgumentParser()
parser.add_argument('--is_hpc_launch', default=False, type=bool)
parser.add_argument('--xircuits_filename', default='{flow_name}', type=str)
"""
body = ast.parse(code).body

Expand Down
5 changes: 3 additions & 2 deletions tvbextxircuits/handlers/component_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from .config import get_config

import xai_components
from xai_components.base_tvb import ComponentWithWidget
from xai_components.base_tvb import ComponentWithWidget, ComponentWithViewer
from tvbextxircuits.logger.builder import get_logger

LOGGER = get_logger(__name__)
Expand Down Expand Up @@ -102,7 +102,8 @@ def read_orig_code(node: ast.AST, lines):


def component_has_widget_assigned(node):
if any(base_class.id == ComponentWithWidget.__name__ for base_class in node.bases):
if any(base_class.id in {ComponentWithWidget.__name__, ComponentWithViewer.__name__}
for base_class in node.bases):
return True

return False
Expand Down
7 changes: 4 additions & 3 deletions tvbextxircuits/handlers/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,20 @@ def post(self):
component_path = input_data["path"]
xircuits_id = input_data["xircuits_id"]
component_inputs = input_data['component_inputs']
xircuits_filename = input_data['xircuits_filename']

notebook_path = self._generate_widget_notebook(component, component_id, component_path, xircuits_id,
component_inputs)
component_inputs, xircuits_filename)
data = {"widget": notebook_path}
self.finish(json.dumps(data))

except KeyError:
data = {"error_msg": "Could not determine the component from POST params!"}
self.finish(json.dumps(data))

def _generate_widget_notebook(self, component, component_id, component_path, xircuits_id, component_inputs):
def _generate_widget_notebook(self, component, component_id, component_path, xircuits_id, component_inputs, xircuits_filename):
factory = NotebookFactory()
notebook = factory.get_notebook_for_component(component, component_id, component_path, component_inputs,
xircuits_id)
xircuits_id, xircuits_filename)
path = factory.store(notebook, component, xircuits_id)
return path
5 changes: 3 additions & 2 deletions tvbextxircuits/hpc_config/pyunicore_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def _dev_mode(self, home_storage, client):
LOGGER.info(f"You are running in dev mode, starting to install {local_package_name} on HPC {self.site}...")
home_storage.rm(local_package_name)
home_storage.upload(
input_file=f'dist/{local_package_name}',
file_name=f'dist/{local_package_name}',
destination=f'{self.env_dir}/{local_package_name}')
self.pip_libraries = self.pip_libraries.replace('tvb-ext-xircuits', local_package_name)
job_description = {
Expand Down Expand Up @@ -221,9 +221,10 @@ def submit_job(self, executable, inputs, do_stage_out):
LOGGER.info(f"Successfully finished the environment setup.")

LOGGER.info("Launching workflow...")
xircuits_filename = executable.replace('.py', '')
job_description = {
self.EXECUTABLE_KEY: f"{self._module_load_command} && {self._activate_command} && "
f"python {executable} --is_hpc_launch=True",
f"python {executable} --is_hpc_launch=True --xircuits_filename='{xircuits_filename}'",
self.PROJECT_KEY: self.project}
job_workflow = client.new_job(job_description, inputs=inputs)
LOGGER.info(f"Job is running at {self.site}."
Expand Down
Loading
Loading