From 97ed8c456442e13b70b59261e93131fe9afaf33a Mon Sep 17 00:00:00 2001
From: Matthias Schnepf <matthias.schnepf@student.kit.edu>
Date: Fri, 1 Dec 2017 15:58:57 +0100
Subject: [PATCH] add disk space

---
 classes/JDLCreator.py | 21 +++++++++++++++++++++
 create_jdl.py         |  3 ++-
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/classes/JDLCreator.py b/classes/JDLCreator.py
index 1d8908d..1a19a7f 100755
--- a/classes/JDLCreator.py
+++ b/classes/JDLCreator.py
@@ -65,6 +65,7 @@ class JDLCreator(object):
         self._cloud_site = CloudSite(site_name.lower())
         self._wall_time = int(wall_time)
         self._memory = 0
+        self._disk_space = 0
         self._job_folder = job_folder
         self._output_files = []
         self._input_files = []
@@ -214,6 +215,23 @@ class JDLCreator(object):
         """Set requested number of cores"""
         self.cpus = cpus_
 
+    @property
+    def disk_space(self):
+        """Requested disk space in MB"""
+        return self._disk_space
+
+    @memory.setter
+    def disk_space(self, disk_space_):
+        # type: (int) -> None
+        """Expected maximum disk_space (upper limit) in MB"""
+        self._disk_space = disk_space_
+
+    def SetMemory(self, disk_space_):
+        # type: (int) -> None
+        """Expected maximum disk space (upper limit) in MB"""
+        self.memory = disk_space_
+
+
     @property
     def accounting_group(self):
         """Get accounting group"""
@@ -461,6 +479,9 @@ class JDLCreator(object):
         if self._cpus > 1:
             jdl_content.append('request_cpus = %d' % self._cpus)
 
+        if self._disk_space > 0:
+            jdl_content.append('request_disk = %d' % (1024 * self._disk_space))
+
         # add accounting group, if set
         if self._accounting_group is not "":
             jdl_content.append('accounting_group = %s' % self._accounting_group)
diff --git a/create_jdl.py b/create_jdl.py
index e4df4d3..8d29c8d 100644
--- a/create_jdl.py
+++ b/create_jdl.py
@@ -15,6 +15,7 @@ def main():
     jobs.executable = "job.sh"  # name of the job script
     jobs.wall_time = 10 * 60 * 60  # job will finish in 10 hours
     jobs.memory = 2048  # Our regular 2 GB per core
+    jobs.disk_space = 200
 
     # build list of arguments: 1,2,3,4,5
     arguments = [x for x in range(0, 5)]
@@ -23,7 +24,7 @@ def main():
     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.requirements = "(Target.ProvidesCPU ==True) && (TARGET.ProvidesEKPResources == 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
-- 
GitLab