
__author__ = 'Miroslav Bauer'


import os
import json

cwd = os.getcwd()+'/jobs/'

# API commands templates
#===============================================
COMPUTE = ['COMPUTE'] 
GETAGS = ['GETAGENTS'] 
RELAGS = ['RELOADAGENTS'] 
PING = ['PING'] 
ECHO = ['ECHO', 'this is echo!']

# Common job attrs
#================================================
rsb = {}
rsb['requires'] = {}
rsb['requires']['os']       = 'linux'
rsb['requires']['packages'] = 'abc'
rsb['requires']['arch']     = 'x86_64'

out = {}
out['pos']   = 'stdout'
out['type']  = 'string'
out['inout'] = 'out'
out['name']  = 'abcout'

# BIG DATA job template
#================================================
rs = dict(rsb)
rs['file']     = cwd+'bigdata/run'
rs['required'] = [cwd+'bigdata/required_files/']

p1 = {}
p2 = {}
p1['pos']   = 1
p1['type']  = 'file'
p1['inout'] = 'in'
p1['value'] = cwd+'bigdata/5xp1.blif'

p2['pos']   = 2
p2['type']  = 'file'
p2['inout'] = 'out'
p2['value'] = cwd+'bigdata/result/result.blif'
p2['name']  = 'resultblif'
ps = [p1,p2,out]
BIGDATA = json.dumps({'runscript':rs,"parameters":ps})
BIGDATA_L = json.dumps({'runscript':rs,"parameters":ps,"preferred":"localhost_forked"})
BIGDATA_G = json.dumps({'runscript':rs,"parameters":ps,"preferred":"metacentrum"})

# CPU HEAVY job template
#==================================================
rs = dict(rsb)
rs['file'] = cwd+'cpuheavy/run'
rs['required'] = [cwd+'cpuheavy/required_files/']

p1 = {}
p2 = {}
p1['pos']   = 1
p1['type']  = 'file'
p1['inout'] = 'in'
p1['value'] = cwd+'cpuheavy/5xp1.blif'

p2['pos']   = 2
p2['type']  = 'file'
p2['inout'] = 'out'
p2['value'] = cwd+'cpuheavy/result/result.blif'
p2['name']  = 'resultblif'
ps = [p1,p2,out]

CPUHEAVY = json.dumps({'runscript':rs,"parameters":ps})
CPUHEAVY_L = json.dumps({'runscript':rs,"parameters":ps,"preferred":"localhost_forked"})
CPUHEAVY_G = json.dumps({'runscript':rs,"parameters":ps,"preferred":"metacentrum"})

