Пример #1
0
def test_shellcmd_backend_create_spooldir():
    with temporary_directory() as tmpdir:
        with temporary_core(spooldir=tmpdir) as core:
            assert 'test' in core.resources
            backend = core.get_backend('test')
            app = SuccessfulApp()
            core.submit(app)
            assert os.path.isdir(backend.spooldir)
Пример #2
0
                                     stdout="stdout.txt",
                                     join=True)


# assume the number to square is given on the command-line
x = int(sys.argv[1])

# Read configuration from the default configuration file, and create
# an instance of `Core`.
cfg = gc3libs.config.Configuration(*gc3libs.Default.CONFIG_FILE_LOCATIONS,
                                   auto_enable_auth=False)
core = gc3libs.core.Core(cfg)

# create an instance of SquareApplication and submit it
app = SquareApplication(x)
core.submit(app)

# After submssion, you have to check the application for its state:
# if state is NEW, then submission failed
if app.execution.state == gc3libs.Run.State.NEW:
    print("Failed submitting application, check log for errors.")
    sys.exit(1)
else:
    print("SquareApplication successfully submitted,"
          " remote job ID is: %s" % app.execution.lrms_jobid)

# Periodically check the status of your application.
while app.execution.state in [
        gc3libs.Run.State.SUBMITTED,
        gc3libs.Run.State.RUNNING,
]:
Пример #3
0
# create an instance of GdemoSimpleApp
app = GdemoSimpleApp()

# create an instance of Core. Read configuration from your default
# configuration file
cfg = gc3libs.config.Configuration(*gc3libs.Default.CONFIG_FILE_LOCATIONS,
                                   **{'auto_enable_auth': True})
core = gc3libs.core.Core(cfg)

# in case you want to select a specific resource, call
# `Core.select_resource(...)`
if len(sys.argv)>1:
    core.select_resource(sys.argv[1])

# Submit your application.
core.submit(app)

# After submssion, you have to check the application for its state:
print  "Job id: %s" % app.execution.lrms_jobid

# Periodically check the status of your application.
while app.execution.state in [ gc3libs.Run.State.SUBMITTED,
                               gc3libs.Run.State.RUNNING,
                               ]:
    try:
        print "Job in status %s " % app.execution.state
        time.sleep(5)
        # This call will contact the resource(s) and get the current
        # job state
        core.update_job_state(app)
        sys.stdout.write("[ %s ]\r" % app.execution.state)