{section: This page has useful classad tranform rules.}
+use by saving each as a file, and passing that file to condor_transform_ads like this:
+{term}
+condor_transform_ads -rules to_docker.xfm -in vanilla_jobs.ads -out docker_jobs.ads
+{endterm}
+
{subsubsection: Convert job to docker job}
Invoke with Image=<image-name> to override default docker image
@@ -100,3 +105,114 @@
X86_64 FREEBSD FreeBSD10 1003 FreeBSD 10 FreeBSD FREEBSD
)
{endsnip}
+
+{subsubsection: Generate simulated dynamic slots from a partitionable slot}
+Converts a partitionable STARTD ads from a single machine, into a partitionable slot ad and multiple dynamic slot ads. It does *NOT* properly adjust the partitionable slot ad to account for resources consumed by the dynamic slot ads.
+Invoke with
+*: DOMAIN=x.y.z set the default domain for generated machine names
+*: User=bob set the name of the simulated user for the dynamic slots
+*: NumDynSlots=N control the number of dynamic slots
+*: ReqMem=NN set the memory assigned to the dynamic slots
+
+{snip: to_dyn_slots.xfm}
+# Simulate one or more active dynamic slots from an idle partitionable one
+# The original partitionable slot is passed through untransfomed followed
+# by N partitionable slots by the TRANSFORM N+1 statement
+#
+
+# this trick currently results in infinite loop... if they are self-references <sigh>
+Client = $(Client:submit.chtc.wisc.edu)
+User = $(User:bob)
+ReqMem = $(ReqMem:4000)
+NumDynSlots = $(NumDynSlots:1)
+
+#IpAddr = split(MyAddress,"<?>&")[0]
+EVALMACRO AddrIp = $(My.AddressV1)[0].a
+EVALMACRO AddrPort = $(My.AddressV1)[0].port
+EVALMACRO Slot = splitslotname(Name)[0]
+
+#CurrentTime = time()
+#CurrentTime = $EVAL(CurrentTime)
+EVALMACRO CurrentTime time()
+
+SET MyCurrentTime = $(CurrentTime)
+DELETE /^Updates.+/
+if defined UPDATE
+ SET UpdateSequenceNumber $(Update)
+endif
+
+if defined DOMAIN
+ EVALMACRO Host = split("$(My.Machine)",".")[0]
+ SET Machine "$(Host).$F(DOMAIN)"
+ SET Name "$(Slot)@$(Host).$F(DOMAIN)"
+endif
+
+SET ClassAdLifetime 600
+
+if $(Step)
+ # Convert partitionable slot to dynamic slot
+ #
+ SET NAME "$(Slot)_$(Step)@$(My.Machine)"
+ DELETE PartitionableSlot
+ DELETE NumDynamicSlots
+ DELETE /^Child.+/
+ SET ParentSlotId $(My.SlotId)
+ SET DynamicSlot true
+ SET SlotType "Dynamic"
+ SET SlotTypeId -1
+ SET Activity "Busy"
+ SET State "Claimed"
+ SET PublicClaimId "<$(AddrIp):$(AddrPort)>#$(CurrentTime)#$RANDOM_INTEGER(10000,20000,1)#..."
+
+ # set info about the executing job and claim
+ #
+ SET JobId "$RANDOM_INTEGER(11100,22200,1).0"
+ SET JobUniverse 5
+ EVALSET JobStart time() - 60*16
+ SET NumPids 2
+ SET GlobalJobId "$(Client)#$(MY.JobId)#$(CurrentTime)"
+ SET ImageSize $RANDOM_INTEGER(100000,1000000,128)
+ SET ExecutableSize 3
+ EVALSET ResidentSetSize ImageSize + $RANDOM_INTEGER(1000,10000,128)
+ COPY JobStart EnteredCurrentState
+ COPY JobStart EnteredCurrentActivity
+ EVALSET TotalClaimRunTime time() - EnteredCurrentState
+ COPY TotalClaimRunTime TotalJobRunTime
+ COPY TotalClaimRunTime TotalTimeClaimedBusy
+ SET TotalTimeClaimedIdle 2
+ DELETE TotalTimeDrainedRetiring
+ DELETE TotalTimeUnclaimedIdle
+ DELETE TotalTimeUnclaimedBenchmarking
+ EVALSET RetirementTimeRemaining 60*60*24*3 - TotalClaimRunTime
+
+ # set ownership
+ #
+ SET NiceUser false
+ SET RemoteOwner "$(User)@chtc.wisc.edu"
+ COPY RemoteOwner RemoteUser
+ SET RemoteNegotiatingGroup "<none>"
+ SET RemoteAutoregroup false
+ SET ClientMachine "$(Client)"
+
+ # set resource usage
+ #
+ SET Cpus 1
+ COPY Cpus TotalSlotCpus
+ SET RequestMemory $(ReqMem)
+ EVALSET Memory quantize($(ReqMem),256)
+ COPY Memory TotalSlotMemory
+ SET MemoryUsage ((ResidentSetSize + 1023)/1024)
+ EVALSET Disk Disk/40.0
+ COPY Disk TotalSlotDisk
+
+
+else
+
+ # Pass original Partitionable Slot through unmolested at step 0
+ # Should maybe subtract resource usage from it?
+
+
+endif
+
+TRANSFORM 1+$(NumDynSlots:1)
+{endsnip}