Skip to content
Snippets Groups Projects
Commit 06de4606 authored by Frank Fischer's avatar Frank Fischer
Browse files

Expand example usage with more comments

parent 76b8f0b3
Branches
No related tags found
No related merge requests found
......@@ -48,7 +48,6 @@ class CloudSite(object):
class JDLCreator(object):
"""Class to create JDL files for EKP HTCondor system."""
"""Lines for output, log and errors."""
LINE_OUTPUT = 'output = out/$(Process).out'
LINE_ERROR = 'error = error/$(Process).err'
......@@ -57,6 +56,7 @@ class JDLCreator(object):
def __init__(self, site_name='', executable='', wall_time=0, job_folder='.',
extra_lines='', output_files='', arguments=''):
# types (str, str, int, str, list, str, list) -> None
"""Class to create JDL files for EKP HTCondor system."""
###
# public attributes - user is allowed to change these values
......@@ -371,9 +371,7 @@ class JDLCreator(object):
[print(line) for line in self.__get_JDL_content()]
def WriteJDL(self, exe='', arguments=''):
"""Create folder (if set) and write JDLFile, argument list file,
copy job in the folder"""
"""Create job_folder (if set) and write JDLFile & argument list file; also copies job in the folder"""
if len(exe) > 0:
self.executable = exe
if len(arguments) > 0:
......
#!/usr/bin/env python
from classes.JDLCreator import JDLCreator # import the class to create and submit JDL files
import numpy
from classes.JDLCreator import JDLCreator # import the class to create and submit JDL files
def main():
jobs = JDLCreator() #run jobs on condocker cloude site
##################################
# submit job
##################################
jobs.SetExecutable("job.sh") # set job script
"""Submit a simple example job"""
jobs = JDLCreator() # Default (no Cloud Site supplied): Docker with SLC6 image
# Some example sites:
# site_name='condocker' Exclusively run the job on our desktop cluster
# site_name='bwforcluster' Freiburg
# site_name='ekpsupermachines' "Super Machines" in floor 9 server room
# site_name='gridka' gridKa School Training VMs
jobs.executable = "job.sh" # name of the job script
jobs.wall_time = 3 # job will finish in 3 seconds, it's just some "echo"s
jobs.memory = 64 # We're running a simple bash script. 64 MB memory are more than enough
#build list of arguments
arguments=[]
for i in numpy.arange(0, 5,1):
arguments.append(i)
# build list of arguments: 1,2,3,4,5
arguments = [x for x in range(0, 5)]
# you can also build a regular list via arg = []; arg.append(value)
jobs.SetArguments(arguments) # set arguments
jobs.arguments = arguments # set arguments for condor job
# Our job requires lots of CPU resources and needs access to the local EKP resources
jobs.requirements = "(Target.PROVIDES_CPU ==True) && (TARGET.PROVIDES_EKP_RESOURCES == True)"
jobs.job_folder = 'condor_jobs' # set name of the folder, where files and information are stored
jobs.WriteJDL() # write an JDL file and create folder for log files
jobs.requirements= "(Target.PROVIDES_CPU ==True) && (TARGET.PROVIDES_EKP_RESOURCES == True)"
jobs.SetFolder('condor_jobs/') # set folder !!! you have to copy your job file into the folder
jobs.WriteJDL() # write an JDL file and create folder for log files
if __name__ == "__main__":
main()
......@@ -5,6 +5,3 @@ echo "hostname: " hostname
echo "how am I? " whoami
pwd
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment