Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
""" Example application demonstrating job submission via bigjob
DON'T EDIT THIS FILE (UNLESS THERE IS A BUG)
THIS FILE SHOULD NOT BE COMMITTED TO SVN WITH USER-SPECIFIC PATHS!
"""
import os
import time
import pdb
import sys
import saga
try :
import pudb
pudb.set_interrupt_handler()
except :
pass
# configuration
""" This variable defines the coordination system that is used by BigJob
e.g.
advert://localhost (SAGA/Advert SQLITE)
advert://advert.cct.lsu.edu:8080 (SAGA/Advert POSTGRESQL)
redis://localhost:6379 (Redis at localhost)
tcp://localhost (ZMQ)
tcp://* (ZMQ - listening to all interfaces)
"""
#COORDINATION_URL = "advert://localhost/?dbtype=sqlite3"
#COORDINATION_URL = "tcp://*"
COORDINATION_URL = "redis://10.0.1.18:6379"
def setUp(self):
from django.db import connection
from django.db.models.base import ModelBase
from django.core.management.color import no_style
from django_sphinxsearch.managers import SearchManager
# Create a dummy model which extends the mixin
import pudb; pudb.set_trace()
self.model = ModelBase('__TestModel__{}'.format(self.mixin.__name__), (self.mixin, ),
{ '__module__': self.mixin.__module__ })
# Create the schema for our test model
self._style = no_style()
sql, _ = connection.creation.sql_create_model(self.model, self._style)
self._cursor = connection.cursor()
for statement in sql:
self._cursor.execute(statement)
self.model.search = SearchManager(index="test_index", fields={'data': 100}, limit=10)
self.model.search.contribute_to_class(model=self.model, name="search")
source_data = (
"Python is a programming language that lets you work more quickly and integrate your systems more effectively.",
"You can learn to use Python and see almost immediate gains in productivity and lower maintenance costs.",
"Python runs on Windows, Linux/Unix, Mac OS X, and has been ported to the Java and .NET virtual machines.",
def mount(self):
self._pudb_get_debugger = pudb._get_debugger
pudb._get_debugger = self._get_debugger
def post_mortem(tb, excinfo):
dbg = pudb._get_debugger()
stack, i = dbg.get_stack(None, tb)
dbg.reset()
i = _find_last_non_hidden_frame(stack)
dbg.interaction(stack[i][0], excinfo._excinfo)
def mount(self):
self._pudb_get_debugger = pudb._get_debugger
pudb._get_debugger = self._get_debugger
def unmount(self):
if self._pudb_get_debugger:
pudb._get_debugger = self._pudb_get_debugger
self._pudb_get_debugger = None
def test_load_breakpoints(mocker):
fake_data = ['b /home/user/test.py:41'], ['b /home/user/test.py:50']
mock_open = mocker.mock_open()
mock_open.return_value.readlines.side_effect = fake_data
mocker.patch.object(builtins, 'open', mock_open)
mocker.patch('pudb.settings.lookup_module',
mocker.Mock(return_value='/home/user/test.py'))
mocker.patch('pudb.settings.get_breakpoint_invalid_reason',
mocker.Mock(return_value=None))
result = load_breakpoints()
expected = [('/home/user/test.py', 41, False, None, None),
('/home/user/test.py', 50, False, None, None)]
assert result == expected
import sys
import radical.saga as saga
import pudb; pudb.set_interrupt_handler()
def main () :
try:
i = 0
js = saga.job.Service ("fork://localhost/")
while True :
i = i+1
j = js.run_job ("/bin/true")
print("%5d : %-30s : %s" % (i, j.id, j.state))
j.wait ()
import os
import sys
import radical.saga as saga
import pudb; pudb.set_interrupt_handler()
USER_ID = "merzky"
REMOTE_HOST = "ssh://gw68.quarry.iu.teragrid.org"
REMOTE_HOST = "fork://localhost"
def main () :
try:
for i in range(0, 1000):
print(("**************************** Job: %d *****************************" % i))
ctx = saga.Context("ssh")
ctx.user_id = USER_ID
session = saga.Session()
session.add_context(ctx)
import os
import time
import pilot
try:
import pudb
pudb.set_interrupt_handler()
except:
pass
#########################################################################
##
redis_password = os.environ.get('REDIS_PASSWORD')
COORD = "redis://%s@gw68.quarry.iu.teragrid.org:6379" % redis_password
HOST = "ssh://localhost"
##
#########################################################################
N = 20
pjs = []
start = time.time()
total = 0.0