Skip to content

Instantly share code, notes, and snippets.

@remram44
Created July 30, 2014 16:01
Show Gist options
  • Save remram44/9454edf54d58909ee69b to your computer and use it in GitHub Desktop.
Save remram44/9454edf54d58909ee69b to your computer and use it in GitHub Desktop.
vistrails-core.ipynb
Display the source blob
Display the rendered blob
Raw
{
"metadata": {
"name": "vistrails-core"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "code",
"collapsed": false,
"input": [
"import vistrails\n",
"import vistrails.core.application\n",
"import vistrails.core.api as API"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 1
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Application initialization\n",
"\n",
"Here I'm using a core application, which means a lot of features are not available (such as the spreadsheet)\n",
"\n",
"Note that I must pass args=[], because else sys.argv is used (and that contains the arguments to IPython, which VisTrails cannot make sense of)."
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"vt_app = vistrails.core.application.init(args=[])"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stderr",
"text": [
"INFO:VisLog:vistrails\\core\\modules\\module_registry.py, line 1621\n",
"Initializing basic_modules\n"
]
},
{
"output_type": "stream",
"stream": "stderr",
"text": [
"INFO:VisLog:vistrails\\core\\modules\\module_registry.py, line 1621\n",
"Initializing controlflow\n"
]
},
{
"output_type": "stream",
"stream": "stderr",
"text": [
"INFO:VisLog:vistrails\\core\\modules\\module_registry.py, line 1621\n",
"Initializing CLTools\n"
]
},
{
"output_type": "stream",
"stream": "stderr",
"text": [
"INFO:VisLog:vistrails\\core\\modules\\module_registry.py, line 1621\n",
"Initializing dialogs\n"
]
},
{
"output_type": "stream",
"stream": "stderr",
"text": [
"INFO:VisLog:vistrails\\core\\modules\\module_registry.py, line 1621\n",
"Initializing pythonCalc\n"
]
},
{
"output_type": "stream",
"stream": "stderr",
"text": [
"INFO:VisLog:vistrails\\core\\modules\\module_registry.py, line 1621\n",
"Initializing ImageMagick\n"
]
},
{
"output_type": "stream",
"stream": "stderr",
"text": [
"INFO:VisLog:vistrails\\core\\modules\\module_registry.py, line 1621\n",
"Initializing parallelflow\n"
]
},
{
"output_type": "stream",
"stream": "stderr",
"text": [
"INFO:VisLog:vistrails\\core\\modules\\module_registry.py, line 1621\n",
"Initializing tabledata\n"
]
},
{
"output_type": "stream",
"stream": "stderr",
"text": [
"INFO:VisLog:vistrails\\core\\modules\\module_registry.py, line 1621\n",
"Initializing copy\n"
]
},
{
"output_type": "stream",
"stream": "stderr",
"text": [
"INFO:VisLog:vistrails\\core\\modules\\module_registry.py, line 1621\n",
"Initializing matplotlib\n"
]
},
{
"output_type": "stream",
"stream": "stderr",
"text": [
"INFO:VisLog:vistrails\\core\\modules\\module_registry.py, line 1621\n",
"Initializing HTTP\n"
]
},
{
"output_type": "stream",
"stream": "stderr",
"text": [
"INFO:VisLog:vistrails\\core\\modules\\module_registry.py, line 1621\n",
"Initializing abstraction\n"
]
}
],
"prompt_number": 2
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"vt_app.new_vistrail()"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "pyout",
"prompt_number": 3,
"text": [
"True"
]
}
],
"prompt_number": 3
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"api = vistrails.core.api.get_api()"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 4
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"api.open_vistrail('examples/gcd.vt')"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stderr",
"text": [
"INFO:VisLog:vistrails\\core\\vistrail\\controller.py, line 3146\n",
"Processing upgrades in package \"org.vistrails.vistrails.pythoncalc\"\n",
"MissingPackageVersion: Missing version 0.9.1 of package org.vistrails.vistrails.pythoncalc\n",
"\n",
"MissingPackageVersion: Missing version 0.9.1 of package org.vistrails.vistrails.pythoncalc\n",
"\n"
]
},
{
"output_type": "stream",
"stream": "stderr",
"text": [
"INFO:VisLog:vistrails\\core\\upgradeworkflow.py, line 222\n",
"Package \"org.vistrails.vistrails.pythoncalc\" cannot handle upgrade request. VisTrails will attempt automatic upgrade.\n"
]
},
{
"output_type": "stream",
"stream": "stderr",
"text": [
"INFO:VisLog:vistrails\\core\\upgradeworkflow.py, line 222\n",
"Package \"org.vistrails.vistrails.pythoncalc\" cannot handle upgrade request. VisTrails will attempt automatic upgrade.\n"
]
},
{
"output_type": "pyout",
"prompt_number": 5,
"text": [
"True"
]
}
],
"prompt_number": 5
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"res = api.execute()"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"3\n"
]
}
],
"prompt_number": 6
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"print res[0][0].write_source()"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
".conns_added = set([48L, 47L])\n",
".errors = {}\n",
".executed = {25L: True, 26L: True, 27L: True}\n",
".modules_added = set([25L, 26L, 27L])\n",
".objects = {25L: <vistrails.packages.controlflow.looping.While object at 0x0AB1E770>, 26L: <vistrails.core.modules.basic_modules.StandardOutput object at 0x0AB6E810>, 27L: <vistrails.core.modules.sub_module.Group object at 0x0AB6EDF0>}\n",
".parameter_changes = []\n",
".suspended = {}\n",
"\n"
]
}
],
"prompt_number": 7
}
],
"metadata": {}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment