Skip to content

Instantly share code, notes, and snippets.

@sergiobuj
Last active June 11, 2020 16:15
Show Gist options
  • Select an option

  • Save sergiobuj/5559095 to your computer and use it in GitHub Desktop.

Select an option

Save sergiobuj/5559095 to your computer and use it in GitHub Desktop.
Condorfy like a pro
# RiSE Group - Sergio B
# Condor description file
Notify_user = condorjobs@sbuj.co
Universe = vanilla
Executable = /opt/python/bin/python2.7
Arguments = performance_script.py
Log = log/fast_performance.log.$(Cluster)
Output = log/fast_performance.out.$(Cluster).$(Process)
Error = log/fast_performance.time.$(Cluster).$(Process)
+RequiresWholeMachine = True
Requirements = (Machine == "compute-2-6.local") && (Target.CAN_RUN_WHOLE_MACHINE =?= True)
Notification = Error
#Queue 19
#Notification = Always
Queue
# RiSE Group - Sergio B
# Condor DAG
JOB A0 fast_clusterpy.condor
JOB B0 fast_clusterpy.condor
JOB C0 fast_clusterpy.condor
JOB D0 fast_clusterpy.condor
JOB E0 fast_clusterpy.condor
JOB F0 fast_clusterpy.condor
JOB G0 fast_clusterpy.condor
JOB H0 fast_clusterpy.condor
JOB I0 fast_clusterpy.condor
JOB J0 fast_clusterpy.condor
JOB A1 fast_clusterpy.condor
JOB B1 fast_clusterpy.condor
JOB C1 fast_clusterpy.condor
JOB D1 fast_clusterpy.condor
JOB E1 fast_clusterpy.condor
JOB F1 fast_clusterpy.condor
JOB G1 fast_clusterpy.condor
JOB H1 fast_clusterpy.condor
JOB I1 fast_clusterpy.condor
JOB J1 fast_clusterpy.condor
JOB END submit_echo.condor
SCRIPT POST END cat log/fast_performance.time.* > consolidated_fast_times
PARENT A0 B0 C0 D0 E0 F0 G0 H0 I0 J0 A1 B1 C1 D1 E1 F1 G1 H1 I1 J1 CHILD END
# encoding: latin2
"""
TEST FILE
"""
__author__ = "Juan C. Duque"
__credits__ = "Copyright (c) 2009-11 Juan C. Duque"
__license__ = "GPL"
__version__ = "1.0.0"
__maintainer__ = "RiSE Group"
__email__ = "contacto@rise-group.org"
import clusterpy
import numpy
import time as tm
import sys
tests = [('n100', 10), ('n529', 53), ('n1024', 102), ('n2025', 202)]
#tests = tests[3:4]
algorithms = ['arisel', 'azp', 'azpSa', 'azpTabu', 'azpRTabu', 'maxpTabu', 'random' ]
algorithms = algorithms[:1]
results = []
timess = {}
# -------------------------------------------------------------------
# IMPORTANT
#--------------------------------------------------------------------
# Change the following paths acording to the location on you computer
inputsPath = "clusterpy/data_examples/"
outputsPath = "testOutputs/"
for test,pReg in tests:
for algorithm in algorithms:
fileName = inputsPath + test
output = outputsPath + test + "_" + algorithm
if algorithm == 'arisel':
instance = clusterpy.importArcData(fileName)
instance.cluster('arisel', ['SAR1'], pReg, dissolve=1, inits=5)
field = instance.fieldNames[-1]
results.append(instance.outputCluster[field])
instance.results[0].exportArcData(output)
instance.exportArcData(output)
print >> sys.stderr, "%d\t%f\t%f" %( pReg, instance.outputCluster[ instance.results[0].outputDissolve['fieldName'] ].get('objectiveFunction'), instance.outputCluster[ instance.results[0].outputDissolve['fieldName'] ].get('runningTime'))
# RiSE Group - Sergio B
# Condor description file
Notify_user = condorjobs@sbuj.co
Universe = vanilla
Executable = /opt/python/bin/python2.7
Arguments = performance_script.py
Log = log/slow_performance.log.$(Cluster)
Output = log/slow_performance.out.$(Cluster).$(Process)
Error = log/slow_performance.time.$(Cluster).$(Process)
Requirements = (Machine == "compute-2-6.local")
Notification = Error
#Queue 19
#Notification = Always
Queue
# RiSE Group - Sergio B
# Condor DAG
JOB A0 slow_clusterpy.condor
JOB B0 slow_clusterpy.condor
JOB C0 slow_clusterpy.condor
JOB D0 slow_clusterpy.condor
JOB E0 slow_clusterpy.condor
JOB F0 slow_clusterpy.condor
JOB G0 slow_clusterpy.condor
JOB H0 slow_clusterpy.condor
JOB I0 slow_clusterpy.condor
JOB J0 slow_clusterpy.condor
JOB A1 slow_clusterpy.condor
JOB B1 slow_clusterpy.condor
JOB C1 slow_clusterpy.condor
JOB D1 slow_clusterpy.condor
JOB E1 slow_clusterpy.condor
JOB F1 slow_clusterpy.condor
JOB G1 slow_clusterpy.condor
JOB H1 slow_clusterpy.condor
JOB I1 slow_clusterpy.condor
JOB J1 slow_clusterpy.condor
JOB END submit_echo.condor
SCRIPT POST END cat log/slow_performance.time.* > consolidated_slow_times
PARENT A0 B0 C0 D0 E0 F0 G0 H0 I0 J0 A1 B1 C1 D1 E1 F1 G1 H1 I1 J1 CHILD END
# RiSE Group - Sergio B
# Condor checkpoint job
Notify_user = condorjobs@sbuj.co
Universe = vanilla
Executable = /bin/echo
Arguments = "FINISHED"
Notification = Always
Queue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment