bugged
stringlengths
4
228k
fixed
stringlengths
0
96.3M
__index_level_0__
int64
0
481k
def modified(event): """When an object is modified, execute rules assigned to its parent """ if is_portal_factory(event.object): return # Let the special handler take care of IObjectInitializedEvent if not IObjectInitializedEvent.providedBy(event): execute(aq_parent(aq_inner(event.object)), event)
def modified(event): """When an object is modified, execute rules assigned to its parent """ if is_portal_factory(event.object): return # Let the special handler take care of IObjectInitializedEvent if not IObjectInitializedEvent.providedBy(event): execute(aq_parent(aq_inner(event.object)), event)
477,200
def modified(event): """When an object is modified, execute rules assigned to its parent """ if is_portal_factory(event.object): return # Let the special handler take care of IObjectInitializedEvent if not IObjectInitializedEvent.providedBy(event): execute(aq_parent(aq_inner(event.object)), event)
def modified(event): """When an object is modified, execute rules assigned to its parent """ if is_portal_factory(event.object): return # Let the special handler take care of IObjectInitializedEvent if not IObjectInitializedEvent.providedBy(event): execute(aq_parent(aq_inner(event.object)), event)
477,201
def modified(event): """When an object is modified, execute rules assigned to its parent """ if is_portal_factory(event.object): return # Let the special handler take care of IObjectInitializedEvent if not IObjectInitializedEvent.providedBy(event): execute(aq_parent(aq_inner(event.object)), event)
def modified(event): """When an object is modified, execute rules assigned to its parent """ if is_portal_factory(event.object): return # Let the special handler take care of IObjectInitializedEvent if not IObjectInitializedEvent.providedBy(event): execute(aq_parent(aq_inner(event.object)), event)
477,202
def calc_global(problem_data): """ Calculates global stiffness matrix, assembly of elemental systems are included here instead of defining an extra function for assembly """ print("Calculating global system...") global NEN, NEN_range, functions, a, V1, V2, c, f, shape_funcs #Defining global variables NEN = problem_data["NEN"] NEN_range = range(NEN) #Taking coefficient functions of DE out of problem data functions = problem_data["functions"] a = functions["a"] V1 = functions["V1"] V2 = functions["V2"] c = functions["c"] f = functions["f"] #Defining shape functions shape_funcs = problem_data["shapefunc"] print(" * Creating matrixes...") NN = problem_data["NN"] K = sparse.lil_matrix((NN, NN)) F = zeros((NN, 1)) print(" * Calculating K and F matrixes...") for e_nodes in problem_data["LtoG"]: Ke, Fe = calc_elem(problem_data, e_nodes) for i, node_i in enumerate(e_nodes): F[node_i] += Fe[i] for j, node_j in enumerate(e_nodes): K[node_i, node_j] += Ke[i][j] print(" * Freeing up memory (1/2)...") del problem_data["GQ"] del problem_data["UV"] del problem_data["functions"] if problem_data["BCs"] != "null": K, F = apply_bc(problem_data, K, F) print (" * Freeing up memory (2/2)...") del problem_data["LtoG"] del problem_data["BCs"] print(" * Converting LIL to CSR format...") K = K.tocsr() return K, F
def calc_global(problem_data): """ Calculates global stiffness matrix, assembly of elemental systems are included here instead of defining an extra function for assembly """ print("Calculating global system...") global NEN, NEN_range, functions, a, V1, V2, c, f, shape_funcs #Defining global variables NEN = problem_data["NEN"] NEN_range = range(NEN) #Taking coefficient functions of DE out of problem data functions = problem_data["functions"] a = functions["a"] V1 = functions["V1"] V2 = functions["V2"] c = functions["c"] f = functions["f"] #Defining shape functions shape_funcs = problem_data["shapefunc"] print(" * Creating matrixes...") NN = problem_data["NN"] K = sparse.lil_matrix((NN, NN)) F = zeros((NN, 1)) print(" * Calculating K and F matrixes...") for e_nodes in problem_data["LtoG"]: Ke, Fe = calc_elem(problem_data, e_nodes) for i, node_i in enumerate(e_nodes): F[node_i] += Fe[i] for j, node_j in enumerate(e_nodes): K[node_i, node_j] += Ke[i][j] print(" * Freeing up memory (1/2)...") del problem_data["GQ"] del problem_data["UV"] del problem_data["functions"] if problem_data["BCs"]: K, F = apply_bc(problem_data, K, F) print (" * Freeing up memory (2/2)...") del problem_data["LtoG"] del problem_data["BCs"] print(" * Converting LIL to CSR format...") K = K.tocsr() return K, F
477,203
def check_dependencies(self): """ determines if current VisTrail will be supported by the repository's VisTrail server """
def check_dependencies(self): """ determines if current VisTrail will be supported by the repository's VisTrail server """
477,204
def check_dependencies(self): """ determines if current VisTrail will be supported by the repository's VisTrail server """
def check_dependencies(self): """ determines if current VisTrail will be supported by the repository's VisTrail server """
477,205
def push_vistrail_to_repository(self, branching=False): """ uploads current VisTrail to web repository """
def push_vistrail_to_repository(self, branching=False): """ uploads current VisTrail to web repository """
477,206
def check_url(url): try: p = urlparse(url) h = HTTP(p[1]) h.putrequest('HEAD', p[2]) h.endheaders() if h.getreply()[0] == 200: return True else: return False except: return False
def check_url(url): try: p = urlparse(url) h = HTTP(p[1]) h.putrequest('HEAD', p[2]) h.endheaders() if h.getreply()[0] == 200: return True else: return False except Exception, e: log(str(e)) return False
477,207
def check_url(url): try: p = urlparse(url) h = HTTP(p[1]) h.putrequest('HEAD', p[2]) h.endheaders() if h.getreply()[0] == 200: return True else: return False except: return False
def check_url(url): try: p = urlparse(url) h = HTTP(p[1]) h.putrequest('HEAD', p[2]) h.endheaders() if h.getreply()[0] == 200: return True else: return False except: return False
477,208
def check_url(url): try: p = urlparse(url) h = HTTP(p[1]) h.putrequest('HEAD', p[2]) h.endheaders() if h.getreply()[0] == 200: return True else: return False except: return False
def check_url(url): try: p = urlparse(url) h = HTTP(p[1]) h.putrequest('HEAD', p[2]) h.endheaders() if h.getreply()[0] == 200: return True else: return False except: return False
477,209
def attempt_automatic_upgrade(controller, pipeline, module_id): """attempt_automatic_upgrade(module_id, pipeline): [Action]
def attempt_automatic_upgrade(controller, pipeline, module_id): """attempt_automatic_upgrade(module_id, pipeline): [Action]
477,210
def attempt_automatic_upgrade(controller, pipeline, module_id): """attempt_automatic_upgrade(module_id, pipeline): [Action]
def attempt_automatic_upgrade(controller, pipeline, module_id): """attempt_automatic_upgrade(module_id, pipeline): [Action]
477,211
def check_connection_port(port): try: port_type = PortSpec.port_type_map.inverse[port.type] s = reg.get_port_spec_from_descriptor(d, port.name, port_type)
def check_connection_port(port): try: port_type = PortSpec.port_type_map.inverse[port.type] s = reg.get_port_spec_from_descriptor(d, port.name, port_type)
477,212
def check_connection_port(port): try: port_type = PortSpec.port_type_map.inverse[port.type] s = reg.get_port_spec_from_descriptor(d, port.name, port_type)
def check_connection_port(port): try: port_type = PortSpec.port_type_map.inverse[port.type] s = reg.get_port_spec_from_descriptor(d, port.name, port_type)
477,213
def create_new_connection(src_module, src_port, dst_module, dst_port): # spec -> name, type, signature output_port_id = controller.id_scope.getNewId(Port.vtType) if type(src_port) == type(""): output_port_spec = \ src_module.get_port_spec(src_port, 'output') output_port = Port(id=output_port_id, spec=output_port_spec, moduleId=src_module.id, moduleName=src_module.name) else: output_port = Port(id=output_port_id, name=src_port.name, type=src_port.type, signature=src_port.signature, moduleId=src_module.id, moduleName=src_module.name)
def create_new_connection(src_module, src_port, dst_module, dst_port): # spec -> name, type, signature output_port_id = controller.id_scope.getNewId(Port.vtType) if type(src_port) == type(""): if ((src_port, 'output')) in local_port_specs: output_port_spec = local_port_specs[(src_port, 'output')] else: output_port_spec = \ src_module.get_port_spec(src_port, 'output') output_port = Port(id=output_port_id, spec=output_port_spec, moduleId=src_module.id, moduleName=src_module.name) else: output_port = Port(id=output_port_id, name=src_port.name, type=src_port.type, signature=src_port.signature, moduleId=src_module.id, moduleName=src_module.name)
477,214
def create_new_connection(src_module, src_port, dst_module, dst_port): # spec -> name, type, signature output_port_id = controller.id_scope.getNewId(Port.vtType) if type(src_port) == type(""): output_port_spec = \ src_module.get_port_spec(src_port, 'output') output_port = Port(id=output_port_id, spec=output_port_spec, moduleId=src_module.id, moduleName=src_module.name) else: output_port = Port(id=output_port_id, name=src_port.name, type=src_port.type, signature=src_port.signature, moduleId=src_module.id, moduleName=src_module.name)
def create_new_connection(src_module, src_port, dst_module, dst_port): # spec -> name, type, signature output_port_id = controller.id_scope.getNewId(Port.vtType) if type(src_port) == type(""): output_port_spec = \ src_module.get_port_spec(src_port, 'output') output_port = Port(id=output_port_id, spec=output_port_spec, moduleId=src_module.id, moduleName=src_module.name) else: output_port = Port(id=output_port_id, name=src_port.name, type=src_port.type, signature=src_port.signature, moduleId=src_module.id, moduleName=src_module.name)
477,215
def __init__(self, parent = None): QtGui.QDialog.__init__(self, parent) core.debug.DebugPrint.getInstance().set_stream(debugStream(self.write)) self.setWindowTitle('VisTrails messages') layout = QtGui.QVBoxLayout() self.setLayout(layout) self.list = QtGui.QListWidget() self.connect(self.list, QtCore.SIGNAL('itemDoubleClicked(QListWidgetItem *)'), self.showMessage) self.msg_box = None
def __init__(self, parent = None): QtGui.QDialog.__init__(self, parent) core.debug.DebugPrint.getInstance().set_stream(debugStream(self.write)) self.setWindowTitle('VisTrails Messages') layout = QtGui.QVBoxLayout() self.setLayout(layout) self.list = QtGui.QListWidget() self.connect(self.list, QtCore.SIGNAL('itemDoubleClicked(QListWidgetItem *)'), self.showMessage) self.msg_box = None
477,216
def __init__(self, parent = None): QtGui.QDialog.__init__(self, parent) core.debug.DebugPrint.getInstance().set_stream(debugStream(self.write)) self.setWindowTitle('VisTrails messages') layout = QtGui.QVBoxLayout() self.setLayout(layout) self.list = QtGui.QListWidget() self.connect(self.list, QtCore.SIGNAL('itemDoubleClicked(QListWidgetItem *)'), self.showMessage) self.msg_box = None
def __init__(self, parent = None): QtGui.QDialog.__init__(self, parent) core.debug.DebugPrint.getInstance().set_stream(debugStream(self.write)) self.setWindowTitle('VisTrails messages') layout = QtGui.QVBoxLayout() self.setLayout(layout) self.list = QtGui.QListWidget() self.connect(self.list, QtCore.SIGNAL('currentItemChanged(QListWidgetItem *, QListWidgetItem *)'), self.showMessage) self.msg_box = None
477,217
def __init__(self, parent = None): QtGui.QDialog.__init__(self, parent) core.debug.DebugPrint.getInstance().set_stream(debugStream(self.write)) self.setWindowTitle('VisTrails messages') layout = QtGui.QVBoxLayout() self.setLayout(layout) self.list = QtGui.QListWidget() self.connect(self.list, QtCore.SIGNAL('itemDoubleClicked(QListWidgetItem *)'), self.showMessage) self.msg_box = None
def __init__(self, parent = None): QtGui.QDialog.__init__(self, parent) core.debug.DebugPrint.getInstance().set_stream(debugStream(self.write)) self.setWindowTitle('VisTrails messages') layout = QtGui.QVBoxLayout() self.setLayout(layout) self.list = QtGui.QListWidget() self.connect(self.list, QtCore.SIGNAL('itemDoubleClicked(QListWidgetItem *)'), self.showMessage) self.msg_box = None
477,218
def __init__(self, parent = None): QtGui.QDialog.__init__(self, parent) core.debug.DebugPrint.getInstance().set_stream(debugStream(self.write)) self.setWindowTitle('VisTrails messages') layout = QtGui.QVBoxLayout() self.setLayout(layout) self.list = QtGui.QListWidget() self.connect(self.list, QtCore.SIGNAL('itemDoubleClicked(QListWidgetItem *)'), self.showMessage) self.msg_box = None
def __init__(self, parent = None): QtGui.QDialog.__init__(self, parent) core.debug.DebugPrint.getInstance().set_stream(debugStream(self.write)) self.setWindowTitle('VisTrails messages') layout = QtGui.QVBoxLayout() self.setLayout(layout) self.list = QtGui.QListWidget() self.connect(self.list, QtCore.SIGNAL('itemDoubleClicked(QListWidgetItem *)'), self.showMessage) self.msg_box = None
477,219
def __init__(self, parent = None): QtGui.QDialog.__init__(self, parent) core.debug.DebugPrint.getInstance().set_stream(debugStream(self.write)) self.setWindowTitle('VisTrails messages') layout = QtGui.QVBoxLayout() self.setLayout(layout) self.list = QtGui.QListWidget() self.connect(self.list, QtCore.SIGNAL('itemDoubleClicked(QListWidgetItem *)'), self.showMessage) self.msg_box = None
def __init__(self, parent = None): QtGui.QDialog.__init__(self, parent) core.debug.DebugPrint.getInstance().set_stream(debugStream(self.write)) self.setWindowTitle('VisTrails messages') layout = QtGui.QVBoxLayout() self.setLayout(layout) self.list = QtGui.QListWidget() self.connect(self.list, QtCore.SIGNAL('itemDoubleClicked(QListWidgetItem *)'), self.showMessage) self.msg_box = None
477,220
def __init__(self, parent = None): QtGui.QDialog.__init__(self, parent) core.debug.DebugPrint.getInstance().set_stream(debugStream(self.write)) self.setWindowTitle('VisTrails messages') layout = QtGui.QVBoxLayout() self.setLayout(layout) self.list = QtGui.QListWidget() self.connect(self.list, QtCore.SIGNAL('itemDoubleClicked(QListWidgetItem *)'), self.showMessage) self.msg_box = None
def __init__(self, parent = None): QtGui.QDialog.__init__(self, parent) core.debug.DebugPrint.getInstance().set_stream(debugStream(self.write)) self.setWindowTitle('VisTrails messages') layout = QtGui.QVBoxLayout() self.setLayout(layout) self.list = QtGui.QListWidget() self.connect(self.list, QtCore.SIGNAL('itemDoubleClicked(QListWidgetItem *)'), self.showMessage) self.msg_box = None
477,221
def __init__(self, parent = None): QtGui.QDialog.__init__(self, parent) core.debug.DebugPrint.getInstance().set_stream(debugStream(self.write)) self.setWindowTitle('VisTrails messages') layout = QtGui.QVBoxLayout() self.setLayout(layout) self.list = QtGui.QListWidget() self.connect(self.list, QtCore.SIGNAL('itemDoubleClicked(QListWidgetItem *)'), self.showMessage) self.msg_box = None
def __init__(self, parent = None): QtGui.QDialog.__init__(self, parent) core.debug.DebugPrint.getInstance().set_stream(debugStream(self.write)) self.setWindowTitle('VisTrails messages') layout = QtGui.QVBoxLayout() self.setLayout(layout) self.list = QtGui.QListWidget() self.connect(self.list, QtCore.SIGNAL('itemDoubleClicked(QListWidgetItem *)'), self.showMessage) self.msg_box = None
477,222
def __init__(self, parent = None): QtGui.QDialog.__init__(self, parent) core.debug.DebugPrint.getInstance().set_stream(debugStream(self.write)) self.setWindowTitle('VisTrails messages') layout = QtGui.QVBoxLayout() self.setLayout(layout) self.list = QtGui.QListWidget() self.connect(self.list, QtCore.SIGNAL('itemDoubleClicked(QListWidgetItem *)'), self.showMessage) self.msg_box = None
def __init__(self, parent = None): QtGui.QDialog.__init__(self, parent) core.debug.DebugPrint.getInstance().set_stream(debugStream(self.write)) self.setWindowTitle('VisTrails messages') layout = QtGui.QVBoxLayout() self.setLayout(layout) self.list = QtGui.QListWidget() self.connect(self.list, QtCore.SIGNAL('itemDoubleClicked(QListWidgetItem *)'), self.showMessage) self.msg_box = None
477,223
def __init__(self, parent = None): QtGui.QDialog.__init__(self, parent) core.debug.DebugPrint.getInstance().set_stream(debugStream(self.write)) self.setWindowTitle('VisTrails messages') layout = QtGui.QVBoxLayout() self.setLayout(layout) self.list = QtGui.QListWidget() self.connect(self.list, QtCore.SIGNAL('itemDoubleClicked(QListWidgetItem *)'), self.showMessage) self.msg_box = None
def __init__(self, parent = None): QtGui.QDialog.__init__(self, parent) core.debug.DebugPrint.getInstance().set_stream(debugStream(self.write)) self.setWindowTitle('VisTrails messages') layout = QtGui.QVBoxLayout() self.setLayout(layout) self.list = QtGui.QListWidget() self.connect(self.list, QtCore.SIGNAL('itemDoubleClicked(QListWidgetItem *)'), self.showMessage) self.msg_box = None
477,224
def __init__(self, parent = None): QtGui.QDialog.__init__(self, parent) core.debug.DebugPrint.getInstance().set_stream(debugStream(self.write)) self.setWindowTitle('VisTrails messages') layout = QtGui.QVBoxLayout() self.setLayout(layout) self.list = QtGui.QListWidget() self.connect(self.list, QtCore.SIGNAL('itemDoubleClicked(QListWidgetItem *)'), self.showMessage) self.msg_box = None
def __init__(self, parent = None): QtGui.QDialog.__init__(self, parent) core.debug.DebugPrint.getInstance().set_stream(debugStream(self.write)) self.setWindowTitle('VisTrails messages') layout = QtGui.QVBoxLayout() self.setLayout(layout) self.list = QtGui.QListWidget() self.connect(self.list, QtCore.SIGNAL('itemDoubleClicked(QListWidgetItem *)'), self.showMessage) self.msg_box = None
477,225
def copyAll(self): """ copy selected message to clipboard """
defcopyAll(self):"""copyselectedmessagetoclipboard"""
477,226
def showMessage(self, item): """ show item data in a messagebox """ self.showMessageBox(str(item.data(32).toString()))
def showMessage(self, item, olditem): """ show item data in a messagebox """ self.showMessageBox(str(item.data(32).toString()))
477,227
def showMessage(self, item): """ show item data in a messagebox """ self.showMessageBox(str(item.data(32).toString()))
def showMessage(self, item): """ show item data in a messagebox """ self.showMessageBox(str(item.data(32).toString()))
477,228
def showMessageBox(self, s): s = str(s).strip() msgs = s.split('\n') if self.msg_box and self.msg_box.isVisible(): self.msg_box.close() msg_box = QtGui.QMessageBox(self.parent()) self.msg_box = msg_box if msgs[0] == "INFO": msg_box.setIcon(QtGui.QMessageBox.Information) msg_box.setWindowTitle("Information") elif msgs[0] == "WARNING": msg_box.setIcon(QtGui.QMessageBox.Warning) msg_box.setWindowTitle("Warning") elif msgs[0] == "CRITICAL": msg_box.setIcon(QtGui.QMessageBox.Critical) msg_box.setWindowTitle("Critical error") msg_box.setText(msgs[3]) text = "Time: %s\n Location: %s\n Message:\n%s" % \ (msgs[1], msgs[2], '\n'.join(msgs[3:])) msg_box.setInformativeText('\n'.join(msgs[4:])) msg_box.setStandardButtons(QtGui.QMessageBox.Ok) msg_box.setDefaultButton(QtGui.QMessageBox.Ok) msg_box.setDetailedText(text) msg_box.show()
def updateMessageBox(self, item): self.currentItem = item msg_box = self.msg_box s = str(item.data(32).toString()) msgs = s.split('\n') if self.msg_box and self.msg_box.isVisible(): self.msg_box.close() msg_box = QtGui.QMessageBox(self.parent()) self.msg_box = msg_box if msgs[0] == "INFO": msg_box.setIcon(QtGui.QMessageBox.Information) msg_box.setWindowTitle("Information") elif msgs[0] == "WARNING": msg_box.setIcon(QtGui.QMessageBox.Warning) msg_box.setWindowTitle("Warning") elif msgs[0] == "CRITICAL": msg_box.setIcon(QtGui.QMessageBox.Critical) msg_box.setWindowTitle("Critical error") msg_box.setText(msgs[3]) text = "Time: %s\n Location: %s\n Message:\n%s" % \ (msgs[1], msgs[2], '\n'.join(msgs[3:])) msg_box.setInformativeText('\n'.join(msgs[4:])) msg_box.setStandardButtons(QtGui.QMessageBox.Ok) msg_box.setDefaultButton(QtGui.QMessageBox.Ok) msg_box.setDetailedText(text) msg_box.show()
477,229
def showMessageBox(self, s): s = str(s).strip() msgs = s.split('\n') if self.msg_box and self.msg_box.isVisible(): self.msg_box.close() msg_box = QtGui.QMessageBox(self.parent()) self.msg_box = msg_box if msgs[0] == "INFO": msg_box.setIcon(QtGui.QMessageBox.Information) msg_box.setWindowTitle("Information") elif msgs[0] == "WARNING": msg_box.setIcon(QtGui.QMessageBox.Warning) msg_box.setWindowTitle("Warning") elif msgs[0] == "CRITICAL": msg_box.setIcon(QtGui.QMessageBox.Critical) msg_box.setWindowTitle("Critical error") msg_box.setText(msgs[3]) text = "Time: %s\n Location: %s\n Message:\n%s" % \ (msgs[1], msgs[2], '\n'.join(msgs[3:])) msg_box.setInformativeText('\n'.join(msgs[4:])) msg_box.setStandardButtons(QtGui.QMessageBox.Ok) msg_box.setDefaultButton(QtGui.QMessageBox.Ok) msg_box.setDetailedText(text) msg_box.show()
def showMessageBox(self, s): s = str(s).strip() msgs = s.split('\n') if msgs[0] == "INFO": msg_box.setIcon(QtGui.QMessageBox.Information) msg_box.setWindowTitle("Information") elif msgs[0] == "WARNING": msg_box.setIcon(QtGui.QMessageBox.Warning) msg_box.setWindowTitle("Warning") elif msgs[0] == "CRITICAL": msg_box.setIcon(QtGui.QMessageBox.Critical) msg_box.setWindowTitle("Critical error") msg_box.setText(msgs[3]) text = "Time: %s\n Location: %s\n Message:\n%s" % \ (msgs[1], msgs[2], '\n'.join(msgs[3:])) msg_box.setInformativeText('\n'.join(msgs[4:])) msg_box.setStandardButtons(QtGui.QMessageBox.Ok) msg_box.setDefaultButton(QtGui.QMessageBox.Ok) msg_box.setDetailedText(text) msg_box.show()
477,230
def showMessageBox(self, s): s = str(s).strip() msgs = s.split('\n') if self.msg_box and self.msg_box.isVisible(): self.msg_box.close() msg_box = QtGui.QMessageBox(self.parent()) self.msg_box = msg_box if msgs[0] == "INFO": msg_box.setIcon(QtGui.QMessageBox.Information) msg_box.setWindowTitle("Information") elif msgs[0] == "WARNING": msg_box.setIcon(QtGui.QMessageBox.Warning) msg_box.setWindowTitle("Warning") elif msgs[0] == "CRITICAL": msg_box.setIcon(QtGui.QMessageBox.Critical) msg_box.setWindowTitle("Critical error") msg_box.setText(msgs[3]) text = "Time: %s\n Location: %s\n Message:\n%s" % \ (msgs[1], msgs[2], '\n'.join(msgs[3:])) msg_box.setInformativeText('\n'.join(msgs[4:])) msg_box.setStandardButtons(QtGui.QMessageBox.Ok) msg_box.setDefaultButton(QtGui.QMessageBox.Ok) msg_box.setDetailedText(text) msg_box.show()
def showMessageBox(self, s): s = str(s).strip() msgs = s.split('\n') if self.msg_box and self.msg_box.isVisible(): self.msg_box.close() msg_box = QtGui.QMessageBox(self.parent()) self.msg_box = msg_box if msgs[0] == "INFO": msg_box.setIcon(QtGui.QMessageBox.Information) msg_box.setWindowTitle("Information") elif msgs[0] == "WARNING": msg_box.setIcon(QtGui.QMessageBox.Warning) msg_box.setWindowTitle("Warning") elif msgs[0] == "CRITICAL": msg_box.setIcon(QtGui.QMessageBox.Critical) msg_box.setWindowTitle("Critical error") msg_box.setText(msgs[3]) text = "Time: %s\n Location: %s\n Message:\n%s" % \ (msgs[1], msgs[2], '\n'.join(msgs[3:])) msg_box.setInformativeText('\n'.join(msgs[4:])) msg_box.setStandardButtons(QtGui.QMessageBox.Ok) msg_box.setDefaultButton(QtGui.QMessageBox.Ok) msg_box.setDetailedText(text) msg_box.show()
477,231
def write(self, s):
def write(self, s):
477,232
def write(self, s):
def write(self, s):
477,233
def write(self, s):
def write(self, s):
477,234
def showEvent(self, e): """closeEvent(e) -> None Event handler called when the dialog is about to close.""" count = self.list.count() if count: self.list.scrollToItem(self.list.item(count-1)) self.emit(QtCore.SIGNAL("messagesView(bool)"), True)
def showEvent(self, e): """closeEvent(e) -> None Event handler called when the dialog is about to close.""" self.emit(QtCore.SIGNAL("messagesView(bool)"), True)
477,235
def load_vistrail(locator, is_abstraction=False): abstraction_files = [] thumbnail_files = [] vistrail = None if locator is None: vistrail = Vistrail() else: res = locator.load() if type(res) == type(SaveBundle(None)): vistrail = res.vistrail abstraction_files.extend(res.abstractions) thumbnail_files.extend(res.thumbnails) else: vistrail = res vistrail.is_abstraction = is_abstraction return (vistrail, abstraction_files, thumbnail_files)
def load_vistrail(locator, is_abstraction=False): from core.vistrail.vistrail import Vistrail abstraction_files = [] thumbnail_files = [] vistrail = None if locator is None: vistrail = Vistrail() else: res = locator.load() if type(res) == type(SaveBundle(None)): vistrail = res.vistrail abstraction_files.extend(res.abstractions) thumbnail_files.extend(res.thumbnails) else: res = locator.load() if type(res) == type(SaveBundle(None)): vistrail = res.vistrail abstraction_files.extend(res.abstractions) thumbnail_files.extend(res.thumbnails) else: vistrail = res vistrail.is_abstraction = is_abstraction return (vistrail, abstraction_files, thumbnail_files)
477,236
def load_vistrail(locator, is_abstraction=False): abstraction_files = [] thumbnail_files = [] vistrail = None if locator is None: vistrail = Vistrail() else: res = locator.load() if type(res) == type(SaveBundle(None)): vistrail = res.vistrail abstraction_files.extend(res.abstractions) thumbnail_files.extend(res.thumbnails) else: vistrail = res vistrail.is_abstraction = is_abstraction return (vistrail, abstraction_files, thumbnail_files)
def load_vistrail(locator, is_abstraction=False): abstraction_files = [] thumbnail_files = [] vistrail = None if locator is None: vistrail = Vistrail() else: vistrail = res vistrail.is_abstraction = is_abstraction return (vistrail, abstraction_files, thumbnail_files)
477,237
def get_vt_graph_png(self, host, port, db_name, vt_id, is_local=True): """get_vt_graph_png(host:str, port: str, db_name: str, vt_id:str) -> str Returns the relative url of the generated image """
def get_vt_graph_png(self, host, port, db_name, vt_id, is_local=True): """get_vt_graph_png(host:str, port: str, db_name: str, vt_id:str) -> str Returns the relative url of the generated image """
477,238
def is_image_stale(filename, host, port, db_name, vt_id): statinfo = os.stat(filename) image_time = datetime.fromtimestamp(statinfo.st_mtime) locator = DBLocator(host=host, port=int(port), database=db_name, user=db_read_user, passwd=db_read_pass, obj_id=int(vt_id), obj_type=None, connection_id=None) vt_mod_time = locator.get_db_modification_time() self.server_logger.info("image time: %s, vt time: %s"%(image_time, vt_mod_time)) if image_time < vt_mod_time: return True else: return False
def is_image_stale(filename, host, port, db_name, vt_id): statinfo = os.stat(filename) image_time = datetime.fromtimestamp(statinfo.st_mtime) locator = DBLocator(host=host, port=int(port), database=db_name, user=db_read_user, passwd=db_read_pass, obj_id=int(vt_id), obj_type=None, connection_id=None) vt_mod_time = locator.get_db_modification_time() self.server_logger.info("image time: %s, vt time: %s"%(image_time, vt_mod_time)) if image_time < vt_mod_time: return True else: return False
477,239
def is_image_stale(filename, host, port, db_name, vt_id): statinfo = os.stat(filename) image_time = datetime.fromtimestamp(statinfo.st_mtime) locator = DBLocator(host=host, port=int(port), database=db_name, user=db_read_user, passwd=db_read_pass, obj_id=int(vt_id), obj_type=None, connection_id=None) vt_mod_time = locator.get_db_modification_time() self.server_logger.info("image time: %s, vt time: %s"%(image_time, vt_mod_time)) if image_time < vt_mod_time: return True else: return False
def is_image_stale(filename, host, port, db_name, vt_id): statinfo = os.stat(filename) image_time = datetime.fromtimestamp(statinfo.st_mtime) locator = DBLocator(host=host, port=int(port), database=db_name, user=db_read_user, passwd=db_read_pass, obj_id=int(vt_id), obj_type=None, connection_id=None) vt_mod_time = locator.get_db_modification_time() self.server_logger.info("image time: %s, vt time: %s"%(image_time, vt_mod_time)) if image_time < vt_mod_time: return True else: return False
477,240
def get_vt_graph_pdf(self, host, port, db_name, vt_id, is_local=True): """get_vt_graph_pdf(host:str, port: str, db_name: str, vt_id:str) -> str Returns the relative url of the generated image """
def get_vt_graph_pdf(self, host, port, db_name, vt_id, is_local=True): """get_vt_graph_pdf(host:str, port: str, db_name: str, vt_id:str) -> str Returns the relative url of the generated image """
477,241
def get_vt_graph_pdf(self, host, port, db_name, vt_id, is_local=True): """get_vt_graph_pdf(host:str, port: str, db_name: str, vt_id:str) -> str Returns the relative url of the generated image """
def get_vt_graph_pdf(self, host, port, db_name, vt_id, is_local=True): """get_vt_graph_pdf(host:str, port: str, db_name: str, vt_id:str) -> str Returns the relative url of the generated image """
477,242
def get_vt_graph_pdf(self, host, port, db_name, vt_id, is_local=True): """get_vt_graph_pdf(host:str, port: str, db_name: str, vt_id:str) -> str Returns the relative url of the generated image """
def get_vt_graph_pdf(self, host, port, db_name, vt_id, is_local=True): """get_vt_graph_pdf(host:str, port: str, db_name: str, vt_id:str) -> str Returns the relative url of the generated image """
477,243
def keyPressEvent(self, e): """keyPressEvent(e) -> None Handle user input a key at a time.
def keyPressEvent(self, e): """keyPressEvent(e) -> None Handle user input a key at a time.
477,244
def keyPressEvent(self, e): """keyPressEvent(e) -> None Handle user input a key at a time.
def keyPressEvent(self, e): """keyPressEvent(e) -> None Handle user input a key at a time.
477,245
def focusNextPrevChild(self, next): """focusNextPrevChild(next) -> None Suppress tabbing to the next window in multi-line commands. """ if next and self.more: return 0 return QtGui.QTextEdit.focusNextPrevChild(self, next)
def focusNextPrevChild(self, next): """focusNextPrevChild(next) -> None Suppress tabbing to the next window in multi-line commands. """ if next and self.more: return 0 return QtGui.QTextEdit.focusNextPrevChild(self, next)
477,246
# def mousePressEvent(self, e):
#return return return return defreturn mousePressEvent(self,return e):
477,247
def flush_delayed_actions(self): start_version = self.current_version desc_key = Action.ANNOTATION_DESCRIPTION for action in self._delayed_actions: self.vistrail.add_action(action, start_version, self.current_session) # HACK to populate upgrade information if (action.has_annotation_with_key(desc_key) and action.get_annotation_by_key(desc_key).value == 'Upgrade'): self.vistrail.set_upgrade(start_version, str(action.id)) self.current_version = action.id start_version = action.id
def flush_delayed_actions(self): start_version = self.current_version desc_key = Action.ANNOTATION_DESCRIPTION for action in self._delayed_actions: self.vistrail.add_action(action, start_version, self.current_session) # HACK to populate upgrade information if (action.has_annotation_with_key(desc_key) and action.get_annotation_by_key(desc_key).value == 'Upgrade'): self.vistrail.set_upgrade(start_version, str(action.id)) self.current_version = action.id start_version = action.id
477,248
def load_wsdl_with_config(wsdlList): """load_wsdl_with_config(wsdlList: list of urls) -> (bool,list) This loads the wsdl list creating config files. Returns a tuple with two values. The first is a boolean that is True in case of success. The second is a list with problematic urls""" global schema global webServicesmodulesDict global complexsdict reg = core.modules.module_registry.get_module_registry() basic = core.modules.basic_modules not_loaded = [] result = True for w in wsdlList: #Validation if the user introduces a blank space in the list of #web services if w == '': continue complexsdict = {} #This dictionary stores the complex types for #a webservice w w = w.strip() #Check to see if the element is not repeated in the web services list numtimes = 0 for element in wsdlList: if w == element.strip(): numtimes = numtimes + 1 if numtimes > 1: print "The following web service is repeated in the list and won't \
def load_wsdl_with_config(wsdlList): """load_wsdl_with_config(wsdlList: list of urls) -> (bool,list) This loads the wsdl list creating config files. Returns a tuple with two values. The first is a boolean that is True in case of success. The second is a list with problematic urls""" global schema global webServicesmodulesDict global complexsdict reg = core.modules.module_registry.get_module_registry() basic = core.modules.basic_modules not_loaded = [] result = True for w in wsdlList: #Validation if the user introduces a blank space in the list of #web services if w == '': continue complexsdict = {} #This dictionary stores the complex types for #a webservice w w = w.strip() #Check to see if the element is not repeated in the web services list numtimes = 0 for element in wsdlList: if w == element.strip(): numtimes = numtimes + 1 if numtimes > 1: print "The following web service is repeated in the list and won't \
477,249
def update_workflow(old_obj, translate_dict): return DBWorkflow.update_version(old_obj.db_workflow, translate_dict, DBWorkflow())
def update_workflow(old_obj, translate_dict): return DBWorkflow.update_version(old_obj.db_workflow, translate_dict, DBWorkflow())
477,250
def update_workflow(old_obj, translate_dict): return DBWorkflow.update_version(old_obj.db_workflow, translate_dict, DBWorkflow())
def update_workflow(old_obj, translate_dict): return DBWorkflow.update_version(old_obj.db_workflow, translate_dict, DBWorkflow())
477,251
def connectSignals(self): """ connectSignals() -> None Map signals between GUI components """ self.connect(self.cancelButton, QtCore.SIGNAL('clicked()'), self.reject) self.connect(self.openButton, QtCore.SIGNAL('clicked()'), self.accept) self.connect(self.addAct, QtCore.SIGNAL('triggered()'), self.showConnConfig) self.connect(self.removeAct, QtCore.SIGNAL('triggered()'), self.connectionList.removeConnection) self.connect(self.connectionList, QtCore.SIGNAL('itemSelectionChanged()'), self.updateDBObjectsList) self.connect(self.connectionList, QtCore.SIGNAL('itemSelectionChanged()'), self.updateButtons) self.connect(self.connectionList, QtCore.SIGNAL('itemClicked(QListWidgetItem *)'), self.updateDBObjectsList) self.connect(self.connectionList, QtCore.SIGNAL("reloadConnections"), self.updateDBObjectsList) self.connect(self.objectList, QtCore.SIGNAL('itemSelectionChanged()'), self.updateButtons) self.connect(self.saveasEdt, QtCore.SIGNAL('textChanged(QString)'), self.updateButtons) self.connect(self.objectList, QtCore.SIGNAL('itemDoubleClicked(QListWidgetItem *)'), self.accept)
def connectSignals(self): """ connectSignals() -> None Map signals between GUI components """ self.connect(self.cancelButton, QtCore.SIGNAL('clicked()'), self.reject) self.connect(self.openButton, QtCore.SIGNAL('clicked()'), self.accept) self.connect(self.addAct, QtCore.SIGNAL('triggered()'), self.showConnConfig) self.connect(self.removeAct, QtCore.SIGNAL('triggered()'), self.connectionList.removeConnection) self.connect(self.connectionList, QtCore.SIGNAL('itemSelectionChanged()'), self.updateDBObjectsList) self.connect(self.connectionList, QtCore.SIGNAL('itemSelectionChanged()'), self.updateButtons) self.connect(self.connectionList, QtCore.SIGNAL("reloadConnections"), self.updateDBObjectsList) self.connect(self.objectList, QtCore.SIGNAL('itemSelectionChanged()'), self.updateButtons) self.connect(self.saveasEdt, QtCore.SIGNAL('textChanged(QString)'), self.updateButtons) self.connect(self.objectList, QtCore.SIGNAL('itemDoubleClicked(QListWidgetItem *)'), self.accept)
477,252
def connectSignals(self): """ connectSignals() -> None Map signals between GUI components """ self.connect(self.cancelButton, QtCore.SIGNAL('clicked()'), self.reject) self.connect(self.openButton, QtCore.SIGNAL('clicked()'), self.accept) self.connect(self.addAct, QtCore.SIGNAL('triggered()'), self.showConnConfig) self.connect(self.removeAct, QtCore.SIGNAL('triggered()'), self.connectionList.removeConnection) self.connect(self.connectionList, QtCore.SIGNAL('itemSelectionChanged()'), self.updateDBObjectsList) self.connect(self.connectionList, QtCore.SIGNAL('itemSelectionChanged()'), self.updateButtons) self.connect(self.connectionList, QtCore.SIGNAL('itemClicked(QListWidgetItem *)'), self.updateDBObjectsList) self.connect(self.connectionList, QtCore.SIGNAL("reloadConnections"), self.updateDBObjectsList) self.connect(self.objectList, QtCore.SIGNAL('itemSelectionChanged()'), self.updateButtons) self.connect(self.saveasEdt, QtCore.SIGNAL('textChanged(QString)'), self.updateButtons) self.connect(self.objectList, QtCore.SIGNAL('itemDoubleClicked(QListWidgetItem *)'), self.accept)
def connectSignals(self): """ connectSignals() -> None Map signals between GUI components """ self.connect(self.cancelButton, QtCore.SIGNAL('clicked()'), self.reject) self.connect(self.openButton, QtCore.SIGNAL('clicked()'), self.accept) self.connect(self.addAct, QtCore.SIGNAL('triggered()'), self.showConnConfig) self.connect(self.removeAct, QtCore.SIGNAL('triggered()'), self.connectionList.removeConnection) self.connect(self.connectionList, QtCore.SIGNAL('itemSelectionChanged()'), self.updateDBObjectsList) self.connect(self.connectionList, QtCore.SIGNAL('itemSelectionChanged()'), self.updateButtons) self.connect(self.connectionList, QtCore.SIGNAL('itemClicked(QListWidgetItem *)'), self.updateDBObjectsList) self.connect(self.connectionList, QtCore.SIGNAL("reloadConnections"), self.updateDBObjectsList) self.connect(self.objectList, QtCore.SIGNAL('itemSelectionChanged()'), self.updateButtons) self.connect(self.saveasEdt, QtCore.SIGNAL('textChanged(QString)'), self.updateButtons) self.connect(self.objectList, QtCore.SIGNAL('itemDoubleClicked(QListWidgetItem *)'), self.accept)
477,253
def __init__(self, parent): QToolWindow.__init__(self, parent=parent) #locals() returns the original dictionary, not a copy as #the docs say app = gui.application.VistrailsApplication self.firstLocals = copy.copy(locals()) self.shell = QShell(self.firstLocals,None) self.setWidget(self.shell) self.setWindowTitle(self.shell.windowTitle()) self.monitorWindowTitle(self.shell) self.vistrails_interpreter = get_default_interpreter()
def __init__(self, parent): QToolWindow.__init__(self, parent=parent) #locals() returns the original dictionary, not a copy as #the docs say self.firstLocals = copy.copy(locals()) self.shell = QShell(self.firstLocals,None) self.setWidget(self.shell) self.setWindowTitle(self.shell.windowTitle()) self.monitorWindowTitle(self.shell) self.vistrails_interpreter = get_default_interpreter()
477,254
def __init__(self, locals=None, parent=None): """Constructor.
def __init__(self, locals=None, parent=None): """Constructor.
477,255
def __init__(self, locals=None, parent=None): """Constructor.
def __init__(self, locals=None, parent=None): """Constructor.
477,256
def verify_wsdl(wsdlList): """verify_wsdl(wsdlList: list of urls) -> (list,list,list) This checks for the wsdls that need to be updated or the files need to be generated and splits them in 3 lists: files that are outdated, updated and ones that an error was generated. """ outdated_list = [] updated_list = [] error_list = [] for w in wsdlList: if w == '': continue try: s = w.split('/') host = s[2] except: msg = "Malformed URL." error_list.append((w,msg)) continue location = w reader = WSDLTools.WSDLReader() load = reader.loadFromURL try: wsdl = load(location) except Exception, e: msg = "Couldn't load wsdl from the web: %s."%str(e) error_list.append((w,msg)) continue directoryname = urllib.quote_plus(w) directoryname = directoryname.replace(".","_") directoryname = directoryname.replace("%","_") directoryname = directoryname.replace("+","_") package_subdirectory = os.path.join(core.system.default_dot_vistrails(), "webServices", directoryname) wsm = WriteServiceModule(wsdl) client_mod = wsm.getClientModuleName() client_file = os.path.join(package_subdirectory, '%s.py' %client_mod) conn = httplib.HTTPConnection(host) filename = '/' + '/'.join(s[3:]) request = conn.request("GET", filename) response = conn.getresponse() remoteHeader = response.msg.getheader('last-modified') isoutdated = False if remoteHeader != None: localFile = client_file reg = core.modules.module_registry.get_module_registry() httpfile = reg.get_descriptor_by_name('edu.utah.sci.vistrails.http', 'HTTPFile').module() try: isoutdated = httpfile.is_outdated(remoteHeader, localFile) except OSError: print "File doesn't exist" isoutdated = True if isoutdated or remoteHeader == None: outdated_list.append(w) else: updated_list.append(w) return (outdated_list,updated_list, error_list)
def verify_wsdl(wsdlList): """verify_wsdl(wsdlList: list of urls) -> (list,list,list) This checks for the wsdls that need to be updated or the files need to be generated and splits them in 3 lists: files that are outdated, updated and ones that an error was generated. """ outdated_list = [] updated_list = [] error_list = [] for w in wsdlList: if w == '': continue try: s = w.split('/') host = s[2] except: msg = "Malformed URL." error_list.append((w,msg)) continue location = w reader = WSDLTools.WSDLReader() load = reader.loadFromURL try: wsdl = load(location) except Exception, e: msg = "Couldn't load wsdl from the web: %s."%str(e) error_list.append((w,msg)) continue directoryname = urllib.quote_plus(w) directoryname = directoryname.replace(".","_") directoryname = directoryname.replace("%","_") directoryname = directoryname.replace("+","_") package_subdirectory = os.path.join(core.system.default_dot_vistrails(), "webServices", directoryname) wsm = WriteServiceModule(wsdl) client_mod = wsm.getClientModuleName() client_file = os.path.join(package_subdirectory, '%s.py' %client_mod) conn = httplib.HTTPConnection(host) filename = '/' + '/'.join(s[3:]) request = conn.request("GET", filename) response = conn.getresponse() remoteHeader = response.msg.getheader('last-modified') isoutdated = False if remoteHeader != None: localFile = client_file reg = core.modules.module_registry.get_module_registry() httpfile = reg.get_descriptor_by_name('edu.utah.sci.vistrails.http', 'HTTPFile').module() try: isoutdated = httpfile._is_outdated(remoteHeader, localFile) except OSError: print "File doesn't exist" isoutdated = True if isoutdated or remoteHeader == None: outdated_list.append(w) else: updated_list.append(w) return (outdated_list,updated_list, error_list)
477,257
def keyPressEvent(self, event): """ keyPressEvent(event: QKeyEvent) -> None Capture 'Del', 'Backspace' for pruning versions when not editing a tag """ selectedItems = self.selectedItems() versions = [item.id for item in selectedItems if type(item)==QGraphicsVersionItem and not item.text.hasFocus()] if (self.controller and len(versions)>0 and event.key() in [QtCore.Qt.Key_Backspace, QtCore.Qt.Key_Delete]): versions = [item.id for item in selectedItems] res = gui.utils.show_question("VisTrails", "Are you sure that you want to " "prune the selected version(s)?", [gui.utils.YES_BUTTON, gui.utils.NO_BUTTON], gui.utils.NO_BUTTON) if res == gui.utils.YES_BUTTON: self.controller.prune_versions(versions) qt_super(QVersionTreeScene, self).keyPressEvent(event)
def keyPressEvent(self, event): """ keyPressEvent(event: QKeyEvent) -> None Capture 'Del', 'Backspace' for pruning versions when not editing a tag """ selectedItems = self.selectedItems() versions = [item.id for item in selectedItems if type(item)==QGraphicsVersionItem and not item.text.hasFocus()] if (self.controller and len(versions)>0 and event.key() in [QtCore.Qt.Key_Backspace, QtCore.Qt.Key_Delete]): versions = [item.id for item in selectedItems] res = gui.utils.show_question("VisTrails", "Are you sure that you want to " "prune the selected version(s)?", [gui.utils.YES_BUTTON, gui.utils.NO_BUTTON], gui.utils.NO_BUTTON) if res == gui.utils.YES_BUTTON: self.controller.prune_versions(versions) qt_super(QVersionTreeScene, self).keyPressEvent(event)
477,258
def new_abstraction(name, vistrail, vt_fname=None, internal_version=-1L): """make_abstraction(name: str, vistrail: (str or Vistrail), registry: ModuleRegistry, vt_fname: str, internal_version: long) -> type Creates a new VisTrails module that is a subclass of Abstraction according to the vistrail file provided and the version. The version can either be a tag (string) or an id (long) """ if type(vistrail) == type(""): vt_fname = vistrail vistrail = read_vistrail(vistrail) elif vt_fname is None: raise VistrailsInternalError("Abstraction must provide " "vt_fname with vistrail") if internal_version == -1L: internal_version = vistrail.get_latest_version() action = vistrail.actionMap[internal_version] pipeline = vistrail.getPipeline(internal_version) # try to make the subworkflow work with the package versions we have pipeline.ensure_modules_are_on_registry() pipeline.ensure_connection_specs() uuid = vistrail.get_annotation('__abstraction_uuid__').value if action.notes is not None: docstring = action.notes else: docstring = None d = {} input_modules = [] output_modules = [] for module in pipeline.module_list: #FIXME make this compare more robust if module.name == 'InputPort' and \ module.package == 'edu.utah.sci.vistrails.basic': input_modules.append(module) elif module.name == 'OutputPort' and \ module.package == 'edu.utah.sci.vistrails.basic': output_modules.append(module) input_ports = [] output_ports = [] input_remap = {} output_remap = {} for module in input_modules: (port_name, sigstring, optional, _) = \ get_port_spec_info(pipeline, module) input_ports.append((port_name, sigstring, optional)) input_remap[port_name] = module for module in output_modules: (port_name, sigstring, optional, _) = \ get_port_spec_info(pipeline, module) output_ports.append((port_name, sigstring, optional)) output_remap[port_name] = module # necessary for group d['_input_ports'] = input_ports d['_output_ports'] = output_ports d['input_remap'] = input_remap d['output_remap'] = output_remap d['pipeline'] = pipeline # abstraction specific d['vt_fname'] = vt_fname d['vistrail'] = vistrail d['internal_version'] = internal_version d['uuid'] = uuid # print "input_ports", d['_input_ports'] # print "output_ports", d['_output_ports'] return new_module(Abstraction, name, d, docstring)
def new_abstraction(name, vistrail, vt_fname=None, internal_version=-1L, pipeline=None): """make_abstraction(name: str, vistrail: (str or Vistrail), registry: ModuleRegistry, vt_fname: str, internal_version: long) -> type Creates a new VisTrails module that is a subclass of Abstraction according to the vistrail file provided and the version. The version can either be a tag (string) or an id (long) """ if type(vistrail) == type(""): vt_fname = vistrail vistrail = read_vistrail(vistrail) elif vt_fname is None: raise VistrailsInternalError("Abstraction must provide " "vt_fname with vistrail") if internal_version == -1L: internal_version = vistrail.get_latest_version() action = vistrail.actionMap[internal_version] pipeline = vistrail.getPipeline(internal_version) # try to make the subworkflow work with the package versions we have pipeline.ensure_modules_are_on_registry() pipeline.ensure_connection_specs() uuid = vistrail.get_annotation('__abstraction_uuid__').value if action.notes is not None: docstring = action.notes else: docstring = None d = {} input_modules = [] output_modules = [] for module in pipeline.module_list: #FIXME make this compare more robust if module.name == 'InputPort' and \ module.package == 'edu.utah.sci.vistrails.basic': input_modules.append(module) elif module.name == 'OutputPort' and \ module.package == 'edu.utah.sci.vistrails.basic': output_modules.append(module) input_ports = [] output_ports = [] input_remap = {} output_remap = {} for module in input_modules: (port_name, sigstring, optional, _) = \ get_port_spec_info(pipeline, module) input_ports.append((port_name, sigstring, optional)) input_remap[port_name] = module for module in output_modules: (port_name, sigstring, optional, _) = \ get_port_spec_info(pipeline, module) output_ports.append((port_name, sigstring, optional)) output_remap[port_name] = module # necessary for group d['_input_ports'] = input_ports d['_output_ports'] = output_ports d['input_remap'] = input_remap d['output_remap'] = output_remap d['pipeline'] = pipeline # abstraction specific d['vt_fname'] = vt_fname d['vistrail'] = vistrail d['internal_version'] = internal_version d['uuid'] = uuid # print "input_ports", d['_input_ports'] # print "output_ports", d['_output_ports'] return new_module(Abstraction, name, d, docstring)
477,259
def new_abstraction(name, vistrail, vt_fname=None, internal_version=-1L): """make_abstraction(name: str, vistrail: (str or Vistrail), registry: ModuleRegistry, vt_fname: str, internal_version: long) -> type Creates a new VisTrails module that is a subclass of Abstraction according to the vistrail file provided and the version. The version can either be a tag (string) or an id (long) """ if type(vistrail) == type(""): vt_fname = vistrail vistrail = read_vistrail(vistrail) elif vt_fname is None: raise VistrailsInternalError("Abstraction must provide " "vt_fname with vistrail") if internal_version == -1L: internal_version = vistrail.get_latest_version() action = vistrail.actionMap[internal_version] pipeline = vistrail.getPipeline(internal_version) # try to make the subworkflow work with the package versions we have pipeline.ensure_modules_are_on_registry() pipeline.ensure_connection_specs() uuid = vistrail.get_annotation('__abstraction_uuid__').value if action.notes is not None: docstring = action.notes else: docstring = None d = {} input_modules = [] output_modules = [] for module in pipeline.module_list: #FIXME make this compare more robust if module.name == 'InputPort' and \ module.package == 'edu.utah.sci.vistrails.basic': input_modules.append(module) elif module.name == 'OutputPort' and \ module.package == 'edu.utah.sci.vistrails.basic': output_modules.append(module) input_ports = [] output_ports = [] input_remap = {} output_remap = {} for module in input_modules: (port_name, sigstring, optional, _) = \ get_port_spec_info(pipeline, module) input_ports.append((port_name, sigstring, optional)) input_remap[port_name] = module for module in output_modules: (port_name, sigstring, optional, _) = \ get_port_spec_info(pipeline, module) output_ports.append((port_name, sigstring, optional)) output_remap[port_name] = module # necessary for group d['_input_ports'] = input_ports d['_output_ports'] = output_ports d['input_remap'] = input_remap d['output_remap'] = output_remap d['pipeline'] = pipeline # abstraction specific d['vt_fname'] = vt_fname d['vistrail'] = vistrail d['internal_version'] = internal_version d['uuid'] = uuid # print "input_ports", d['_input_ports'] # print "output_ports", d['_output_ports'] return new_module(Abstraction, name, d, docstring)
def new_abstraction(name, vistrail, vt_fname=None, internal_version=-1L): """make_abstraction(name: str, vistrail: (str or Vistrail), registry: ModuleRegistry, vt_fname: str, internal_version: long, pipeline: Pipeline) -> type Creates a new VisTrails module that is a subclass of Abstraction according to the vistrail file provided and the version. The version can either be a tag (string) or an id (long) """ if type(vistrail) == type(""): vt_fname = vistrail vistrail = read_vistrail(vistrail) elif vt_fname is None: raise VistrailsInternalError("Abstraction must provide " "vt_fname with vistrail") if internal_version == -1L: internal_version = vistrail.get_latest_version() action = vistrail.actionMap[internal_version] pipeline = vistrail.getPipeline(internal_version) # try to make the subworkflow work with the package versions we have pipeline.ensure_modules_are_on_registry() pipeline.ensure_connection_specs() uuid = vistrail.get_annotation('__abstraction_uuid__').value if action.notes is not None: docstring = action.notes else: docstring = None d = {} input_modules = [] output_modules = [] for module in pipeline.module_list: #FIXME make this compare more robust if module.name == 'InputPort' and \ module.package == 'edu.utah.sci.vistrails.basic': input_modules.append(module) elif module.name == 'OutputPort' and \ module.package == 'edu.utah.sci.vistrails.basic': output_modules.append(module) input_ports = [] output_ports = [] input_remap = {} output_remap = {} for module in input_modules: (port_name, sigstring, optional, _) = \ get_port_spec_info(pipeline, module) input_ports.append((port_name, sigstring, optional)) input_remap[port_name] = module for module in output_modules: (port_name, sigstring, optional, _) = \ get_port_spec_info(pipeline, module) output_ports.append((port_name, sigstring, optional)) output_remap[port_name] = module # necessary for group d['_input_ports'] = input_ports d['_output_ports'] = output_ports d['input_remap'] = input_remap d['output_remap'] = output_remap d['pipeline'] = pipeline # abstraction specific d['vt_fname'] = vt_fname d['vistrail'] = vistrail d['internal_version'] = internal_version d['uuid'] = uuid # print "input_ports", d['_input_ports'] # print "output_ports", d['_output_ports'] return new_module(Abstraction, name, d, docstring)
477,260
def new_abstraction(name, vistrail, vt_fname=None, internal_version=-1L): """make_abstraction(name: str, vistrail: (str or Vistrail), registry: ModuleRegistry, vt_fname: str, internal_version: long) -> type Creates a new VisTrails module that is a subclass of Abstraction according to the vistrail file provided and the version. The version can either be a tag (string) or an id (long) """ if type(vistrail) == type(""): vt_fname = vistrail vistrail = read_vistrail(vistrail) elif vt_fname is None: raise VistrailsInternalError("Abstraction must provide " "vt_fname with vistrail") if internal_version == -1L: internal_version = vistrail.get_latest_version() action = vistrail.actionMap[internal_version] pipeline = vistrail.getPipeline(internal_version) # try to make the subworkflow work with the package versions we have pipeline.ensure_modules_are_on_registry() pipeline.ensure_connection_specs() uuid = vistrail.get_annotation('__abstraction_uuid__').value if action.notes is not None: docstring = action.notes else: docstring = None d = {} input_modules = [] output_modules = [] for module in pipeline.module_list: #FIXME make this compare more robust if module.name == 'InputPort' and \ module.package == 'edu.utah.sci.vistrails.basic': input_modules.append(module) elif module.name == 'OutputPort' and \ module.package == 'edu.utah.sci.vistrails.basic': output_modules.append(module) input_ports = [] output_ports = [] input_remap = {} output_remap = {} for module in input_modules: (port_name, sigstring, optional, _) = \ get_port_spec_info(pipeline, module) input_ports.append((port_name, sigstring, optional)) input_remap[port_name] = module for module in output_modules: (port_name, sigstring, optional, _) = \ get_port_spec_info(pipeline, module) output_ports.append((port_name, sigstring, optional)) output_remap[port_name] = module # necessary for group d['_input_ports'] = input_ports d['_output_ports'] = output_ports d['input_remap'] = input_remap d['output_remap'] = output_remap d['pipeline'] = pipeline # abstraction specific d['vt_fname'] = vt_fname d['vistrail'] = vistrail d['internal_version'] = internal_version d['uuid'] = uuid # print "input_ports", d['_input_ports'] # print "output_ports", d['_output_ports'] return new_module(Abstraction, name, d, docstring)
def new_abstraction(name, vistrail, vt_fname=None, internal_version=-1L): """make_abstraction(name: str, vistrail: (str or Vistrail), registry: ModuleRegistry, vt_fname: str, internal_version: long) -> type Creates a new VisTrails module that is a subclass of Abstraction according to the vistrail file provided and the version. The version can either be a tag (string) or an id (long) """ if type(vistrail) == type(""): vt_fname = vistrail vistrail = read_vistrail(vistrail) elif vt_fname is None: raise VistrailsInternalError("Abstraction must provide " "vt_fname with vistrail") if internal_version == -1L: internal_version = vistrail.get_latest_version() action = vistrail.actionMap[internal_version] pipeline = vistrail.getPipeline(internal_version) # try to make the subworkflow work with the package versions we have pipeline.ensure_modules_are_on_registry() pipeline.ensure_connection_specs() uuid = vistrail.get_annotation('__abstraction_uuid__').value if action.notes is not None: docstring = action.notes else: docstring = None d = {} input_modules = [] output_modules = [] for module in pipeline.module_list: #FIXME make this compare more robust if module.name == 'InputPort' and \ module.package == 'edu.utah.sci.vistrails.basic': input_modules.append(module) elif module.name == 'OutputPort' and \ module.package == 'edu.utah.sci.vistrails.basic': output_modules.append(module) input_ports = [] output_ports = [] input_remap = {} output_remap = {} for module in input_modules: (port_name, sigstring, optional, _) = \ get_port_spec_info(pipeline, module) input_ports.append((port_name, sigstring, optional)) input_remap[port_name] = module for module in output_modules: (port_name, sigstring, optional, _) = \ get_port_spec_info(pipeline, module) output_ports.append((port_name, sigstring, optional)) output_remap[port_name] = module # necessary for group d['_input_ports'] = input_ports d['_output_ports'] = output_ports d['input_remap'] = input_remap d['output_remap'] = output_remap d['pipeline'] = pipeline # abstraction specific d['vt_fname'] = vt_fname d['vistrail'] = vistrail d['internal_version'] = internal_version d['uuid'] = uuid # print "input_ports", d['_input_ports'] # print "output_ports", d['_output_ports'] return new_module(Abstraction, name, d, docstring)
477,261
def add_vt_to_db(self, host, port, db_name, user, vt_filepath, filename, repository_vt_id, repository_creator): """add_vt_to_db(host:str, port:int, db_name:str, user:str, vt_filepath:str(or datastream), filename:str, repository_vt_id:int, repository_creator:str) -> (return_status, int) This will add a vistrail in vt_filepath to the the database. If running on a remote machine, vt_filepath will contain vt file data stream. Before adding it it will annotate the vistrail with the repository_vt_id and repository_creator.
def add_vt_to_db(self, host, port, db_name, user, vt_filepath, filename, repository_vt_id, repository_creator, is_local=True): """add_vt_to_db(host:str, port:int, db_name:str, user:str, vt_filepath:str(or datastream), filename:str, repository_vt_id:int, repository_creator:str) -> (return_status, int) This will add a vistrail in vt_filepath to the the database. If running on a remote machine, vt_filepath will contain vt file data stream. Before adding it it will annotate the vistrail with the repository_vt_id and repository_creator.
477,262
def add_vt_to_db(self, host, port, db_name, user, vt_filepath, filename, repository_vt_id, repository_creator): """add_vt_to_db(host:str, port:int, db_name:str, user:str, vt_filepath:str(or datastream), filename:str, repository_vt_id:int, repository_creator:str) -> (return_status, int) This will add a vistrail in vt_filepath to the the database. If running on a remote machine, vt_filepath will contain vt file data stream. Before adding it it will annotate the vistrail with the repository_vt_id and repository_creator.
def add_vt_to_db(self, host, port, db_name, user, vt_filepath, filename, repository_vt_id, repository_creator): """add_vt_to_db(host:str, port:int, db_name:str, user:str, vt_filepath:str(or datastream), filename:str, repository_vt_id:int, repository_creator:str) -> (return_status, int) This will add a vistrail in vt_filepath to the the database. If running on a remote machine, vt_filepath will contain vt file data stream. Before adding it it will annotate the vistrail with the repository_vt_id and repository_creator.
477,263
def merge_vt(self, host, port, db_name, user, new_vt_filepath, old_db_vt_id): """ Merge new_vt (new_vt_filepath) with current vt (old_db_vt_id)
def merge_vt(self, host, port, db_name, user, new_vt_filepath, old_db_vt_id, is_local=True): """ Merge new_vt (new_vt_filepath) with current vt (old_db_vt_id)
477,264
def run_from_db(self, host, port, db_name, vt_id, path_to_figures, version=None, pdf=False, vt_tag='',parameters=''): self.server_logger.info("Request: run_vistrail_from_db(%s,%s,%s,%s,%s,%s,%s,%s,%s)" % \ (host, port, db_name, vt_id, path_to_figures, version, pdf, vt_tag, parameters))
def run_from_db(self, host, port, db_name, vt_id, path_to_figures, version=None, pdf=False, vt_tag='',parameters='', is_local=True): self.server_logger.info("Request: run_vistrail_from_db(%s,%s,%s,%s,%s,%s,%s,%s,%s)" % \ (host, port, db_name, vt_id, path_to_figures, version, pdf, vt_tag, parameters))
477,265
def get_wf_graph_pdf(self, host, port, db_name, vt_id, version): """get_wf_graph_pdf(host:str, port:int, db_name:str, vt_id:int, version:int) -> str Returns the relative url to the generated PDF """ self.server_logger.info("get_wf_graph_pdf(%s,%s,%s,%s,%s) request received" % \ (host, port, db_name, vt_id, version)) try: vt_id = long(vt_id) version = long(version) subdir = 'workflows' filepath = os.path.join(media_dir, 'graphs', subdir) base_fname = "graph_%s_%s.pdf" % (vt_id, version) filename = os.path.join(filepath,base_fname) if ((not os.path.exists(filepath) or os.path.exists(filepath) and not os.path.exists(filename)) and self.proxies_queue is not None): #this server can send requests to other instances proxy = self.proxies_queue.get() try: result = proxy.get_wf_graph_pdf(host,port,db_name, vt_id, version) self.proxies_queue.put(proxy) self.server_logger.info("get_wf_graph_pdf returning %s"% result) return result except Exception, e: self.server_logger.error(str(e)) return (str(e), 0)
def get_wf_graph_pdf(self, host, port, db_name, vt_id, version, is_local=True): """get_wf_graph_pdf(host:str, port:int, db_name:str, vt_id:int, version:int) -> str Returns the relative url to the generated PDF """ self.server_logger.info("get_wf_graph_pdf(%s,%s,%s,%s,%s) request received" % \ (host, port, db_name, vt_id, version)) try: vt_id = long(vt_id) version = long(version) subdir = 'workflows' filepath = os.path.join(media_dir, 'graphs', subdir) base_fname = "graph_%s_%s.pdf" % (vt_id, version) filename = os.path.join(filepath,base_fname) if ((not os.path.exists(filepath) or os.path.exists(filepath) and not os.path.exists(filename)) and self.proxies_queue is not None): #this server can send requests to other instances proxy = self.proxies_queue.get() try: result = proxy.get_wf_graph_pdf(host,port,db_name, vt_id, version) self.proxies_queue.put(proxy) self.server_logger.info("get_wf_graph_pdf returning %s"% result) return result except Exception, e: self.server_logger.error(str(e)) return (str(e), 0)
477,266
def get_wf_graph_png(self, host, port, db_name, vt_id, version): """get_wf_graph_png(host:str, port:int, db_name:str, vt_id:int, version:int) -> str Returns the relative url to the generated image """ self.server_logger.info("get_wf_graph_png(%s,%s,%s,%s,%s) request received" % \ (host, port, db_name, vt_id, version)) try: vt_id = long(vt_id) version = long(version) subdir = 'workflows' filepath = os.path.join(media_dir, 'graphs', subdir) base_fname = "graph_%s_%s.png" % (vt_id, version) filename = os.path.join(filepath,base_fname) if ((not os.path.exists(filepath) or os.path.exists(filepath) and not os.path.exists(filename)) and self.proxies_queue is not None): #this server can send requests to other instances proxy = self.proxies_queue.get() try: self.server_logger.info("Sending request to %s" % proxy) result = proxy.get_wf_graph_png(host, port, db_name, vt_id, version) self.proxies_queue.put(proxy) self.server_logger.info("returning %s" % result) return result except Exception, e: self.server_logger.error(str(e)) return (str(e), 0) #if it gets here, this means that we will execute on this instance if not os.path.exists(filepath): os.mkdir(filepath)
def get_wf_graph_png(self, host, port, db_name, vt_id, version, is_local=True): """get_wf_graph_png(host:str, port:int, db_name:str, vt_id:int, version:int) -> str Returns the relative url to the generated image """ self.server_logger.info("get_wf_graph_png(%s,%s,%s,%s,%s) request received" % \ (host, port, db_name, vt_id, version)) try: vt_id = long(vt_id) version = long(version) subdir = 'workflows' filepath = os.path.join(media_dir, 'graphs', subdir) base_fname = "graph_%s_%s.png" % (vt_id, version) filename = os.path.join(filepath,base_fname) if ((not os.path.exists(filepath) or os.path.exists(filepath) and not os.path.exists(filename)) and self.proxies_queue is not None): #this server can send requests to other instances proxy = self.proxies_queue.get() try: self.server_logger.info("Sending request to %s" % proxy) result = proxy.get_wf_graph_png(host, port, db_name, vt_id, version) self.proxies_queue.put(proxy) self.server_logger.info("returning %s" % result) return result except Exception, e: self.server_logger.error(str(e)) return (str(e), 0) #if it gets here, this means that we will execute on this instance if not os.path.exists(filepath): os.mkdir(filepath)
477,267
def get_vt_graph_png(self, host, port, db_name, vt_id): """get_vt_graph_png(host:str, port: str, db_name: str, vt_id:str) -> str Returns the relative url of the generated image """
def get_vt_graph_png(self, host, port, db_name, vt_id, is_local=True): """get_vt_graph_png(host:str, port: str, db_name: str, vt_id:str) -> str Returns the relative url of the generated image """
477,268
def get_vt_graph_png(self, host, port, db_name, vt_id): """get_vt_graph_png(host:str, port: str, db_name: str, vt_id:str) -> str Returns the relative url of the generated image """
def get_vt_graph_png(self, host, port, db_name, vt_id): """get_vt_graph_png(host:str, port: str, db_name: str, vt_id:str) -> str Returns the relative url of the generated image """
477,269
def getPDFWorkflowMedley(self, m_id): """getPDFWorkflowMedley(m_id:int) -> str Returns the relative url to the generated image """ self.server_logger.info("getPDFWorkflowMedley(%s) request received" % m_id) try: m_id = int(m_id) medley = self.medley_objs[m_id] except Exception, e: self.server_logger.error(str(e))
def getPDFWorkflowMedley(self, m_id, is_local=True): """getPDFWorkflowMedley(m_id:int) -> str Returns the relative url to the generated image """ self.server_logger.info("getPDFWorkflowMedley(%s) request received" % m_id) try: m_id = int(m_id) medley = self.medley_objs[m_id] except Exception, e: self.server_logger.error(str(e))
477,270
def getPNGWorkflowMedley(self, m_id): self.server_logger.info("getPNGWorkflowMedley(%s) request received" % m_id) try: m_id = int(m_id) medley = self.medley_objs[m_id] except Exception, e: self.server_logger.error(str(e))
def getPNGWorkflowMedley(self, m_id, is_local=True): self.server_logger.info("getPNGWorkflowMedley(%s) request received" % m_id) try: m_id = int(m_id) medley = self.medley_objs[m_id] except Exception, e: self.server_logger.error(str(e))
477,271
def get_vt_tagged_versions(self, host, port, db_name, vt_id): self.server_logger.info("Request: get_vt_tagged_versions(%s,%s,%s,%s)" % \ (host, port, db_name, vt_id)) try: locator = DBLocator(host=host, port=int(port), database=db_name, user=db_read_user, passwd=db_read_pass, obj_id=int(vt_id), obj_type=None, connection_id=None)
def get_vt_tagged_versions(self, host, port, db_name, vt_id, is_local=True): self.server_logger.info("Request: get_vt_tagged_versions(%s,%s,%s,%s)" % \ (host, port, db_name, vt_id)) try: locator = DBLocator(host=host, port=int(port), database=db_name, user=db_read_user, passwd=db_read_pass, obj_id=int(vt_id), obj_type=None, connection_id=None)
477,272
def updateMethod(self): """ updateMethod() -> None Update the method values to vistrail. We only keep a monotonic version tree of the query pipeline, we can skip the actions here. """ methodBox = self.parent().parent().parent() if methodBox.controller: paramList = [] pipeline = methodBox.controller.current_pipeline f = pipeline.modules[methodBox.module.id].functions[self.fId] p = f.params for i in xrange(len(self.fields)): p[i].strValue = str(self.fields[i].editor.contents()) p[i].queryMethod = self.fields[i].selector.getCurrentMethod()
def updateMethod(self): """ updateMethod() -> None Update the method values to vistrail. We only keep a monotonic version tree of the query pipeline, we can skip the actions here. """ methodBox = self.parent().parent().parent().parent() if methodBox.controller: paramList = [] pipeline = methodBox.controller.current_pipeline f = pipeline.modules[methodBox.module.id].functions[self.fId] p = f.params for i in xrange(len(self.fields)): p[i].strValue = str(self.fields[i].editor.contents()) p[i].queryMethod = self.fields[i].selector.getCurrentMethod()
477,273
def get_wf_vt_zip(self, host, port, db_name, vt_id, version): """get_wf_vt_zip(host:str, port:str, db_name:str, vt_id:str, version:str) -> str Returns a vt file containing the single workflow defined by version encoded as base64 string """ self.server_logger.info("Request: get_wf_vt_zip(%s,%s,%s,%s,%s)"%(host, port, db_name, vt_id, version)) try: locator = DBLocator(host=host, port=int(port), database=db_name, user='vtserver', passwd='', obj_id=int(vt_id), obj_type=None, connection_id=None) (v, _ , _) = io.load_vistrail(locator) p = v.getPipeline(long(version)) if p: vistrail = Vistrail() action_list = [] for module in self.pipeline.module_list: action_list.append(('add', module)) for connection in self.pipeline.connection_list: action_list.append(('add', connection)) action = core.db.action.create_action(action_list) vistrail.add_action(action, 0L) vistrail.addTag("Imported workflow", action.id) pipxmlstr = io.serialize(vistrail) result = base64.b64encode(pipxmlstr) else: result = "Error: Pipeline was not materialized" self.server_logger.info(result) except Exception, e: result = "Error: %s"%str(e) self.server_logger.info(result) return result
def get_wf_vt_zip(self, host, port, db_name, vt_id, version): """get_wf_vt_zip(host:str, port:str, db_name:str, vt_id:str, version:str) -> str Returns a vt file containing the single workflow defined by version encoded as base64 string """ self.server_logger.info("Request: get_wf_vt_zip(%s,%s,%s,%s,%s)"%(host, port, db_name, vt_id, version)) try: locator = DBLocator(host=host, port=int(port), database=db_name, user='vtserver', passwd='', obj_id=int(vt_id), obj_type=None, connection_id=None) (v, _ , _) = io.load_vistrail(locator) p = v.getPipeline(long(version)) if p: vistrail = Vistrail() action_list = [] for module in p.module_list: action_list.append(('add', module)) for connection in self.pipeline.connection_list: action_list.append(('add', connection)) action = core.db.action.create_action(action_list) vistrail.add_action(action, 0L) vistrail.addTag("Imported workflow", action.id) pipxmlstr = io.serialize(vistrail) result = base64.b64encode(pipxmlstr) else: result = "Error: Pipeline was not materialized" self.server_logger.info(result) except Exception, e: result = "Error: %s"%str(e) self.server_logger.info(result) return result
477,274
def get_wf_vt_zip(self, host, port, db_name, vt_id, version): """get_wf_vt_zip(host:str, port:str, db_name:str, vt_id:str, version:str) -> str Returns a vt file containing the single workflow defined by version encoded as base64 string """ self.server_logger.info("Request: get_wf_vt_zip(%s,%s,%s,%s,%s)"%(host, port, db_name, vt_id, version)) try: locator = DBLocator(host=host, port=int(port), database=db_name, user='vtserver', passwd='', obj_id=int(vt_id), obj_type=None, connection_id=None) (v, _ , _) = io.load_vistrail(locator) p = v.getPipeline(long(version)) if p: vistrail = Vistrail() action_list = [] for module in self.pipeline.module_list: action_list.append(('add', module)) for connection in self.pipeline.connection_list: action_list.append(('add', connection)) action = core.db.action.create_action(action_list) vistrail.add_action(action, 0L) vistrail.addTag("Imported workflow", action.id) pipxmlstr = io.serialize(vistrail) result = base64.b64encode(pipxmlstr) else: result = "Error: Pipeline was not materialized" self.server_logger.info(result) except Exception, e: result = "Error: %s"%str(e) self.server_logger.info(result) return result
def get_wf_vt_zip(self, host, port, db_name, vt_id, version): """get_wf_vt_zip(host:str, port:str, db_name:str, vt_id:str, version:str) -> str Returns a vt file containing the single workflow defined by version encoded as base64 string """ self.server_logger.info("Request: get_wf_vt_zip(%s,%s,%s,%s,%s)"%(host, port, db_name, vt_id, version)) try: locator = DBLocator(host=host, port=int(port), database=db_name, user='vtserver', passwd='', obj_id=int(vt_id), obj_type=None, connection_id=None) (v, _ , _) = io.load_vistrail(locator) p = v.getPipeline(long(version)) if p: vistrail = Vistrail() action_list = [] for module in self.pipeline.module_list: action_list.append(('add', module)) for connection in p.connection_list: action_list.append(('add', connection)) action = core.db.action.create_action(action_list) vistrail.add_action(action, 0L) vistrail.addTag("Imported workflow", action.id) pipxmlstr = io.serialize(vistrail) result = base64.b64encode(pipxmlstr) else: result = "Error: Pipeline was not materialized" self.server_logger.info(result) except Exception, e: result = "Error: %s"%str(e) self.server_logger.info(result) return result
477,275
def setupScene(self, pipeline): """ setupScene(pipeline: Pipeline) -> None Construct the scene to view a pipeline """ old_pipeline = self.pipeline self.pipeline = pipeline
defsetupScene(self,pipeline):"""setupScene(pipeline:Pipeline)->NoneConstructthescenetoviewapipeline"""old_pipeline=self.pipelineself.pipeline=pipeline
477,276
def setupScene(self, pipeline): """ setupScene(pipeline: Pipeline) -> None Construct the scene to view a pipeline """ old_pipeline = self.pipeline self.pipeline = pipeline
def setupScene(self, pipeline): """ setupScene(pipeline: Pipeline) -> None Construct the scene to view a pipeline """ old_pipeline = self.pipeline self.pipeline = pipeline
477,277
def auto_add_subworkflow(self, subworkflow): if type(subworkflow) == str: return self.add_subworkflow(subworkflow) elif (type(subworkflow) == tuple and len(subworkflow) == 2 and type(subworkflow[0]) == type and type(subworkflow[1]) == dict): descriptor = self.add_subworkflow(subworkflow[0], **subworkflow[1]) return descriptor else: raise TypeError("Expected filename or (filename, kwargs)")
def auto_add_subworkflow(self, subworkflow): if type(subworkflow) == str: return self.add_subworkflow(subworkflow) elif (type(subworkflow) == tuple and len(subworkflow) == 2 and type(subworkflow[0]) == str and type(subworkflow[1]) == dict): descriptor = self.add_subworkflow(subworkflow[0], **subworkflow[1]) return descriptor else: raise TypeError("Expected filename or (filename, kwargs)")
477,278
def check_connection_port(port): try: s = d.get_port_spec(port.name, PortSpec.port_type_map.inverse[port.type]) # the old port spec doesn't actually exist for # the invalid module so we cannot compare! # if s <> port.spec: # msg = ("%s connection to port %s has mismatched type" % # (PortSpec.port_type_map.inverse[port.type], # port.name)) # raise UpgradeWorkflowError(msg) except Exception, e: import traceback traceback.print_exc() msg = ("%s connection to port %s does not exist." % (PortSpec.port_type_map.inverse[port.type], port.name)) raise UpgradeWorkflowError(msg)
def check_connection_port(port): try: port_type = PortSpec.port_type_map.inverse[port.type] s = reg.get_port_spec_from_descriptor(d, port.name, port_type) # the old port spec doesn't actually exist for # the invalid module so we cannot compare! # if s <> port.spec: # msg = ("%s connection to port %s has mismatched type" % # (PortSpec.port_type_map.inverse[port.type], # port.name)) # raise UpgradeWorkflowError(msg) except Exception, e: import traceback traceback.print_exc() msg = ("%s connection to port %s does not exist." % (PortSpec.port_type_map.inverse[port.type], port.name)) raise UpgradeWorkflowError(msg)
477,279
def check_connection_port(port): try: s = d.get_port_spec(port.name, PortSpec.port_type_map.inverse[port.type]) # the old port spec doesn't actually exist for # the invalid module so we cannot compare! # if s <> port.spec: # msg = ("%s connection to port %s has mismatched type" % # (PortSpec.port_type_map.inverse[port.type], # port.name)) # raise UpgradeWorkflowError(msg) except Exception, e: import traceback traceback.print_exc() msg = ("%s connection to port %s does not exist." % (PortSpec.port_type_map.inverse[port.type], port.name)) raise UpgradeWorkflowError(msg)
def check_connection_port(port): try: s = d.get_port_spec(port.name, PortSpec.port_type_map.inverse[port.type]) # the old port spec doesn't actually exist for # the invalid module so we cannot compare! # if s <> port.spec: # msg = ("%s connection to port %s has mismatched type" % # (PortSpec.port_type_map.inverse[port.type], # port.name)) # raise UpgradeWorkflowError(msg) except Exception, e: import traceback traceback.print_exc() msg = ("%s connection to port %s of module %s " "does not exist." % \ (PortSpec.port_type_map.inverse[port.type], port.name, invalid_module.name)) raise UpgradeWorkflowError(msg)
477,280
def check_connection_port(port): try: s = d.get_port_spec(port.name, PortSpec.port_type_map.inverse[port.type]) # the old port spec doesn't actually exist for # the invalid module so we cannot compare! # if s <> port.spec: # msg = ("%s connection to port %s has mismatched type" % # (PortSpec.port_type_map.inverse[port.type], # port.name)) # raise UpgradeWorkflowError(msg) except Exception, e: import traceback traceback.print_exc() msg = ("%s connection to port %s does not exist." % (PortSpec.port_type_map.inverse[port.type], port.name)) raise UpgradeWorkflowError(msg)
def check_connection_port(port): try: s = d.get_port_spec(port.name, PortSpec.port_type_map.inverse[port.type]) # the old port spec doesn't actually exist for # the invalid module so we cannot compare! # if s <> port.spec: # msg = ("%s connection to port %s has mismatched type" % # (PortSpec.port_type_map.inverse[port.type], # port.name)) # raise UpgradeWorkflowError(msg) except Exception, e: import traceback traceback.print_exc() msg = ("%s connection to port %s does not exist." % (PortSpec.port_type_map.inverse[port.type], port.name)) raise UpgradeWorkflowError(msg)
477,281
pattern = re.compile(r"(^\s*?def vistrails_revision\(\):.*?release = ['\"])([a-fA-F0-9]+?)(['\"].*?return release)", re.DOTALL | re.MULTILINE)
pattern = re.compile(r"(^\s*?def vistrails_revision\(\):.*?release = ['\"])([a-fA-F0-9]+?)(['\"].*?return release)", re.DOTALL | re.MULTILINE)
477,282
def errexit(errcodeobj, showtrace=True, *args): errcode = errcodeobj[0] errmsg = errcodeobj[1] if args: errmsg = errmsg % args if showtrace: errio = StringIO() errio.write(errmsg + "\n") traceio = StringIO() traceback.print_exc(file=traceio) traceio.seek(0) errio.writelines([INDENT + line for line in traceio.readlines()]) errio.seek(0) errmsg = errio.read() error(errmsg) exit(errcode)
def errexit(errcodeobj, showtrace=True, *args): errcode = errcodeobj[0] errmsg = errcodeobj[1] if args: errmsg = errmsg % args if showtrace: errio = StringIO() errio.write(errmsg + "\n") traceio = StringIO() traceback.print_exc(file=traceio) traceio.seek(0) errio.writelines([INDENT + line for line in traceio.readlines()]) errio.seek(0) errmsg = errio.read() error(errmsg) exit(errcode)
477,283
def get_wf_modules(self, host, port, db_name, vt_id, version): """get_wf_modules(host:str, port:int, db_name:str, vt_id:int, version:int) -> list of dict Returns a list of information about the modules used in a workflow in a list of dictionaries. The dictionary has the following keys: name, package, documentation. """ self.server_logger.info("Request: get_wf_modules(%s,%s,%s,%s,%s)"%(host, port, db_name, vt_id, version)) try: locator = DBLocator(host=host, port=int(port), database=db_name, user='vtserver', passwd='', obj_id=int(vt_id), obj_type=None, connection_id=None)
def get_wf_modules(self, host, port, db_name, vt_id, version): """get_wf_modules(host:str, port:int, db_name:str, vt_id:int, version:int) -> list of dict Returns a list of information about the modules used in a workflow in a list of dictionaries. The dictionary has the following keys: name, package, documentation. """ self.server_logger.info("Request: get_wf_modules(%s,%s,%s,%s,%s)"%(host, port, db_name, vt_id, version)) try: locator = DBLocator(host=host, port=int(port), database=db_name, user=db_read_user, passwd=db_read_pass, obj_id=int(vt_id), obj_type=None, connection_id=None)
477,284
def add_vt_to_db(self, host, port, db_name, user, vt_filepath, filename, repository_vt_id, repository_creator): """add_vt_to_db(host:str, port:int, db_name:str, user:str, vt_filepath:str, filename:str, repository_vt_id:int, repository_creator:str) -> int This will add a vistrail in vt_filepath to the the database. Before adding it it will annotate the vistrail with the repository_vt_id and repository_creator. """ try: locator = ZIPFileLocator(vt_filepath).load() if repository_vt_id != -1: vistrail = locator.vistrail vistrail.set_annotation('repository_vt_id', repository_vt_id) vistrail.set_annotation('repository_creator', repository_creator) #print "name=%s"%filename db_locator = DBLocator(host=host, port=int(port), database=db_name, name=filename, user=user, passwd='r3P0:4uTH') #print "db_locator %s" % db_locator db_locator.save_as(locator) return db_locator.obj_id except Exception, e: self.server_logger.info("Error: %s"%str(e)) return "FAILURE: %s" %str(e)
def add_vt_to_db(self, host, port, db_name, user, vt_filepath, filename, repository_vt_id, repository_creator): """add_vt_to_db(host:str, port:int, db_name:str, user:str, vt_filepath:str, filename:str, repository_vt_id:int, repository_creator:str) -> int This will add a vistrail in vt_filepath to the the database. Before adding it it will annotate the vistrail with the repository_vt_id and repository_creator. """ try: locator = ZIPFileLocator(vt_filepath).load() if repository_vt_id != -1: vistrail = locator.vistrail vistrail.set_annotation('repository_vt_id', repository_vt_id) vistrail.set_annotation('repository_creator', repository_creator) #print "name=%s"%filename db_locator = DBLocator(host=host, port=int(port), database=db_name, name=filename, user=db_write_user, passwd=db_write_pass) #print "db_locator %s" % db_locator db_locator.save_as(locator) return db_locator.obj_id except Exception, e: self.server_logger.info("Error: %s"%str(e)) return "FAILURE: %s" %str(e)
477,285
def remove_vt_from_db(self, host, port, db_name, user, vt_id): """remove_vt_from_db(host:str, port:int, db_name:str, user:str, vt_id:int) -> 0 or 1 Remove a vistrail from the repository """ config = {} config['host'] = host config['port'] = int(port) config['db'] = db_name config['user'] = user config['passwd'] = 'pass' try: conn = db.services.io.open_db_connection(config) db.services.io.delete_entity_from_db(conn,'vistrail', vt_id) db.services.io.close_db_connection(conn) return 1 except Exception, e: self.server_logger.info("Error: %s"%str(e)) if conn: db.services.io.close_db_connection(conn) return "FAILURE: %s" %str(e)
def remove_vt_from_db(self, host, port, db_name, user, vt_id): """remove_vt_from_db(host:str, port:int, db_name:str, user:str, vt_id:int) -> 0 or 1 Remove a vistrail from the repository """ config = {} config['host'] = host config['port'] = int(port) config['db'] = db_name config['user'] = db_write_user config['passwd'] = db_write_pass try: conn = db.services.io.open_db_connection(config) db.services.io.delete_entity_from_db(conn,'vistrail', vt_id) db.services.io.close_db_connection(conn) return 1 except Exception, e: self.server_logger.info("Error: %s"%str(e)) if conn: db.services.io.close_db_connection(conn) return "FAILURE: %s" %str(e)
477,286
def get_runnable_workflows(self, host, port, db_name, vt_id): print "get_runnable_workflows" try: locator = DBLocator(host=host, port=int(port), database=db_name, user='vtserver', passwd='', obj_id=int(vt_id), obj_type=None, connection_id=None)
def get_runnable_workflows(self, host, port, db_name, vt_id): print "get_runnable_workflows" try: locator = DBLocator(host=host, port=int(port), database=db_name, user=db_read_user, passwd=db_read_pass, obj_id=int(vt_id), obj_type=None, connection_id=None)
477,287
def get_wf_datasets(self, host, port, db_name, vt_id, version): print 'get workflow datasets' self.server_logger.info("Request: get_wf_datasets(%s,%s,%s,%s,%s)"%(host, port, db_name, vt_id, version)) try: locator = DBLocator(host=host, port=int(port), database=db_name, user='vtserver', passwd='', obj_id=int(vt_id), obj_type=None, connection_id=None)
def get_wf_datasets(self, host, port, db_name, vt_id, version): print 'get workflow datasets' self.server_logger.info("Request: get_wf_datasets(%s,%s,%s,%s,%s)"%(host, port, db_name, vt_id, version)) try: locator = DBLocator(host=host, port=int(port), database=db_name, user=db_read_user, passwd=db_read_pass, obj_id=int(vt_id), obj_type=None, connection_id=None)
477,288
def run_from_db(self, host, port, db_name, vt_id, path_to_figures, version=None, vt_tag='', parameters=''):
def run_from_db(self, host, port, db_name, vt_id, path_to_figures, version=None, vt_tag='', parameters=''):
477,289
def get_tag_version(self, host, port, db_name, vt_id, vt_tag): self.server_logger.info("Request: get_tag_version(%s,%s,%s,%s,%s)"%(host, port, db_name, vt_id, vt_tag)) version = -1 try: locator = DBLocator(host=host, port=int(port), database=db_name, user='vtserver', passwd='', obj_id=int(vt_id), obj_type=None, connection_id=None)
def get_tag_version(self, host, port, db_name, vt_id, vt_tag): self.server_logger.info("Request: get_tag_version(%s,%s,%s,%s,%s)"%(host, port, db_name, vt_id, vt_tag)) version = -1 try: locator = DBLocator(host=host, port=int(port), database=db_name, user=db_read_user, passwd=db_read_pass, obj_id=int(vt_id), obj_type=None, connection_id=None)
477,290
def get_vt_xml(self, host, port, db_name, vt_id): self.server_logger.info("Request: get_vt_xml(%s,%s,%s,%s)"%(host, port, db_name, vt_id)) try: locator = DBLocator(host=host, port=int(port), database=db_name, user='vtserver', passwd='', obj_id=int(vt_id), obj_type=None, connection_id=None)
def get_vt_xml(self, host, port, db_name, vt_id): self.server_logger.info("Request: get_vt_xml(%s,%s,%s,%s)"%(host, port, db_name, vt_id)) try: locator = DBLocator(host=host, port=int(port), database=db_name, user=db_read_user, passwd=db_read_pass, obj_id=int(vt_id), obj_type=None, connection_id=None)
477,291
def get_wf_xml(self, host, port, db_name, vt_id, version): self.server_logger.info("Request: get_wf_xml(%s,%s,%s,%s,%s)"%(host, port, db_name, vt_id, version)) try: locator = DBLocator(host=host, port=int(port), database=db_name, user='vtserver', passwd='', obj_id=int(vt_id), obj_type=None, connection_id=None)
def get_wf_xml(self, host, port, db_name, vt_id, version): self.server_logger.info("Request: get_wf_xml(%s,%s,%s,%s,%s)"%(host, port, db_name, vt_id, version)) try: locator = DBLocator(host=host, port=int(port), database=db_name, user=db_read_user, passwd=db_read_pass, obj_id=int(vt_id), obj_type=None, connection_id=None)
477,292
def get_wf_xml(self, host, port, db_name, vt_id, version): self.server_logger.info("Request: get_wf_xml(%s,%s,%s,%s,%s)"%(host, port, db_name, vt_id, version)) try: locator = DBLocator(host=host, port=int(port), database=db_name, user='vtserver', passwd='', obj_id=int(vt_id), obj_type=None, connection_id=None)
def get_wf_xml(self, host, port, db_name, vt_id, version): self.server_logger.info("Request: get_wf_xml(%s,%s,%s,%s,%s)"%(host, port, db_name, vt_id, version)) try: locator = DBLocator(host=host, port=int(port), database=db_name, user='vtserver', passwd='', obj_id=int(vt_id), obj_type=None, connection_id=None)
477,293
def get_vt_zip(self, host, port, db_name, vt_id): """get_vt_zip(host:str, port: str, db_name: str, vt_id:str) -> str Returns a .vt file encoded as base64 string """ self.server_logger.info("Request: get_vt_zip(%s,%s,%s,%s)"%(host, port, db_name, vt_id)) try: locator = DBLocator(host=host, port=int(port), database=db_name, user='vtserver', passwd='', obj_id=int(vt_id), obj_type=None, connection_id=None) save_bundle = locator.load() #create temporary file (fd, name) = tempfile.mkstemp(prefix='vt_tmp', suffix='.vt') os.close(fd) fileLocator = FileLocator(name) fileLocator.save(save_bundle) contents = open(name).read() result = base64.b64encode(contents) os.unlink(name) self.server_logger.info("SUCCESS!") return result except Exception, e: self.server_logger.info("Error: %s"%str(e)) return "FAILURE: %s" %str(e)
def get_vt_zip(self, host, port, db_name, vt_id): """get_vt_zip(host:str, port: str, db_name: str, vt_id:str) -> str Returns a .vt file encoded as base64 string """ self.server_logger.info("Request: get_vt_zip(%s,%s,%s,%s)"%(host, port, db_name, vt_id)) try: locator = DBLocator(host=host, port=int(port), database=db_name, user=db_read_user, passwd=db_read_pass, obj_id=int(vt_id), obj_type=None, connection_id=None) save_bundle = locator.load() #create temporary file (fd, name) = tempfile.mkstemp(prefix='vt_tmp', suffix='.vt') os.close(fd) fileLocator = FileLocator(name) fileLocator.save(save_bundle) contents = open(name).read() result = base64.b64encode(contents) os.unlink(name) self.server_logger.info("SUCCESS!") return result except Exception, e: self.server_logger.info("Error: %s"%str(e)) return "FAILURE: %s" %str(e)
477,294
def get_wf_vt_zip(self, host, port, db_name, vt_id, version): """get_wf_vt_zip(host:str, port:str, db_name:str, vt_id:str, version:str) -> str Returns a vt file containing the single workflow defined by version encoded as base64 string """ self.server_logger.info("Request: get_wf_vt_zip(%s,%s,%s,%s,%s)"%(host, port, db_name, vt_id, version)) try: locator = DBLocator(host=host, port=int(port), database=db_name, user='vtserver', passwd='', obj_id=int(vt_id), obj_type=None, connection_id=None) (v, _ , _) = io.load_vistrail(locator) p = v.getPipeline(long(version)) if p: vistrail = Vistrail() action_list = [] for module in p.module_list: action_list.append(('add', module)) for connection in p.connection_list: action_list.append(('add', connection)) action = core.db.action.create_action(action_list) vistrail.add_action(action, 0L) vistrail.addTag("Imported workflow", action.id) pipxmlstr = io.serialize(vistrail) result = base64.b64encode(pipxmlstr) else: result = "Error: Pipeline was not materialized" self.server_logger.info(result) except Exception, e: result = "Error: %s"%str(e) self.server_logger.info(result) return result
def get_wf_vt_zip(self, host, port, db_name, vt_id, version): """get_wf_vt_zip(host:str, port:str, db_name:str, vt_id:str, version:str) -> str Returns a vt file containing the single workflow defined by version encoded as base64 string """ self.server_logger.info("Request: get_wf_vt_zip(%s,%s,%s,%s,%s)"%(host, port, db_name, vt_id, version)) try: locator = DBLocator(host=host, port=int(port), database=db_name, user=db_read_user, passwd=db_read_pass, obj_id=int(vt_id), obj_type=None, connection_id=None) (v, _ , _) = io.load_vistrail(locator) p = v.getPipeline(long(version)) if p: vistrail = Vistrail() action_list = [] for module in p.module_list: action_list.append(('add', module)) for connection in p.connection_list: action_list.append(('add', connection)) action = core.db.action.create_action(action_list) vistrail.add_action(action, 0L) vistrail.addTag("Imported workflow", action.id) pipxmlstr = io.serialize(vistrail) result = base64.b64encode(pipxmlstr) else: result = "Error: Pipeline was not materialized" self.server_logger.info(result) except Exception, e: result = "Error: %s"%str(e) self.server_logger.info(result) return result
477,295
def get_db_vt_list(self, host, port, db_name): self.server_logger.info("Request: get_db_vistrail_list(%s,%s,%s)"%(host, port, db_name)) config = {} config['host'] = host config['port'] = int(port) config['db'] = db_name config['user'] = 'vtserver' config['passwd'] = '' try: rows = io.get_db_vistrail_list(config) return rows except Exception, e: self.server_logger.info("Error: %s"%str(e)) return "FAILURE: %s" %str(e)
def get_db_vt_list(self, host, port, db_name): self.server_logger.info("Request: get_db_vistrail_list(%s,%s,%s)"%(host, port, db_name)) config = {} config['host'] = host config['port'] = int(port) config['db'] = db_name config['user'] = db_read_user config['passwd'] = db_read_pass try: rows = io.get_db_vistrail_list(config) return rows except Exception, e: self.server_logger.info("Error: %s"%str(e)) return "FAILURE: %s" %str(e)
477,296
def get_db_vt_list_xml(self, host, port, db_name): self.server_logger.info("Request: get_db_vistrail_list(%s,%s,%s)"%(host, port, db_name)) config = {} config['host'] = host config['port'] = int(port) config['db'] = db_name config['user'] = 'vtserver' config['passwd'] = '' try: rows = io.get_db_vistrail_list(config) result = '<vistrails>' for (id, name, mod_time) in rows: result += '<vistrail id="%s" name="%s" mod_time="%s" />'%(id,name,mod_time) result += '</vistrails>' return result except Exception, e: self.server_logger.info("Error: %s"%str(e)) return "FAILURE: %s" %str(e)
def get_db_vt_list_xml(self, host, port, db_name): self.server_logger.info("Request: get_db_vistrail_list(%s,%s,%s)"%(host, port, db_name)) config = {} config['host'] = host config['port'] = int(port) config['db'] = db_name config['user'] = db_read_user config['passwd'] = db_read_pass try: rows = io.get_db_vistrail_list(config) result = '<vistrails>' for (id, name, mod_time) in rows: result += '<vistrail id="%s" name="%s" mod_time="%s" />'%(id,name,mod_time) result += '</vistrails>' return result except Exception, e: self.server_logger.info("Error: %s"%str(e)) return "FAILURE: %s" %str(e)
477,297
def get_vt_tagged_versions(self, host, port, db_name, vt_id): self.server_logger.info("Request: get_vt_tagged_versions(%s,%s,%s,%s)"%(host, port, db_name, vt_id)) try: locator = DBLocator(host=host, port=int(port), database=db_name, user='vtserver', passwd='', obj_id=int(vt_id), obj_type=None, connection_id=None)
def get_vt_tagged_versions(self, host, port, db_name, vt_id): self.server_logger.info("Request: get_vt_tagged_versions(%s,%s,%s,%s)"%(host, port, db_name, vt_id)) try: locator = DBLocator(host=host, port=int(port), database=db_name, user=db_read_user, passwd=db_read_pass, obj_id=int(vt_id), obj_type=None, connection_id=None)
477,298
def check_dependencies(self): """ determines if current VisTrail will be supported by the repository's VisTrail server """
def check_dependencies(self): """ determines if current VisTrail will be supported by the repository's VisTrail server """
477,299