jpata / tthbb13

2 stars 5 forks source link

programmatically call grid-control #119

Open jpata opened 8 years ago

jpata commented 8 years ago

@gkasieczka see this example on how to call gc directly without Popen and thus needing to parse stdout etc.

[jpata@t3ui17 gc]$ cat runner.py
import sys, os
sys.path.append(os.path.abspath(os.path.join("grid-control", 'packages')))

from grid_control.config import createConfig
from grid_control import utils

config = createConfig(configFile = "confs/sparse.conf")
global_config = config.changeView(setSections = ['global'])
global_config.setState(True, 'init')
utils.ensureDirExists(global_config.getWorkPath(), 'work directory')
workflow = global_config.getPlugin('workflow', 'Workflow:global', cls = 'Workflow')
config.factory.freezeConfig(writeConfig = config.getState('init', detail = 'config'))
workflow.run()
jpata commented 8 years ago

@gkasieczka, can you describe the issue you ran into with calling grid-control directly via python? I can't think of why Popen should work while direct calling does not.

gkasieczka commented 8 years ago

I want to run grid-control in -Gc mode when calling. This way it gives control back to main program when done processing.

If I chain two grid-controls then the second one creates the correct jobs but immediately returns control to main.

On Tue, Aug 16, 2016 at 6:27 PM, Joosep Pata notifications@github.com wrote:

@gkasieczka https://github.com/gkasieczka, can you describe the issue you ran into with calling grid-control directly via python? I can't think of why Popen should work while direct calling does not.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jpata/tthbb13/issues/119#issuecomment-240157479, or mute the thread https://github.com/notifications/unsubscribe-auth/AFnXV95uG4Nxm188qOwP-6sML4Qdao0wks5qgeUGgaJpZM4JiD5R .

jpata commented 8 years ago

ah, I see. I think the loop of -c is really quite a simple thing in the gc code (few lines), which could easily be done as well in the master workflow script.