Page History

Turn Off History

This page has useful classad tranform rules.

Convert job to docker job

Invoke with Image=<image-name> to override default docker image

to_docker.xfm 
Name VanillaToDocker
Requirements Universe == 5 && ! WantDocker

# invoker can pass image=<image> on command line to override...
If ! defined image
  image = SL6
Endif

# Convert to docker, rewrite executable to be relative to the sandbox
#
Set     WantDocker  = true
Set     DockerImage = "$F(image)"
Set     Cmd         = "./$Fnx(MY.Cmd)"
Rename  Requirements VanillaRequirements
Set     Requirements = Target.HasDocker

Set accounting group

Set accounting group based on username and preferred group. Assumes that the "groups" user map has been loaded.

set_accounting_group.xfm 
Name SetAccountingGroup
# convert AccountingGroup into a preferred group, then map
# the user into an Accounting group honoring their preference
Rename  AccountingGroup PreferredGroup
Default PreferredGroup  undefined
EvalSet AccountingGroup mapUser("groups", Owner, PreferredGroup)

Simulate batlab execute nodes

Converts a set of STARTD ads from a single machine, into multiple startd ads, each with a different architecture and operating system. Invoke with

to_multi_platform.xfm 
# Transform a each STARTD ad into multiple ads, each with a differnt OS and Arch
NAME Simulate multiple STARTD platforms
REQUIREMENTS MyType == "Machine"

# extract slotname from the ad name and manufacture a machine index
EVALMACRO SLOT = splitslotname(Name)[0]
INDEX = $(ROW)+1

# rewrite the machine name and domain
#
SET UidDomain = "$(DOMAIN:cs.wisc.edu)"
SET Machine = "exec$INT(INDEX,%02d).$(MY.UidDomain)"
if defined SLOT
  SET  Name = "$(SLOT)@$(My.Machine)"
else
  COPY Machine Name
endif
COPY Machine PrivateNetworkName

if $(SharedFileSystem)
  COPY UidDomain FileSystemDomain
else
  COPY Machine FileSystemDomain
endif

SET Arch           = "$(ARCH)"
SET OpSys          = "$(OS)"
SET OpSysAndVer    = "$(OSAndVer)"
SET OpSysVer       = "$(OSVer)"
SET OpSysName      = "$(OSName)"
SET OpSysMajorVer  = "$(OSMajor)"
SET OpSysShortName = "$(OSShort)"
SET OpSysLegacy    = "$(OSLegacy)"


TRANSFORM Arch,OS,OSAndVer,OSVer,OSName,OSMajor,OSShort,OSLegacy from (
  X86_64 LINUX   Debian7      700 Debian       7 Debian  LINUX
  X86_64 LINUX   Debian8      800 Debian       8 Debian  LINUX
  X86_64 LINUX   SL6          602 SL           6 SL      LINUX
  X86_64 LINUX   SL7          702 SL           7 SL      LINUX
  X86_64 LINUX   RedHat6      607 RedHat       6 RedHat  LINUX
  X86_64 LINUX   RedHat6      607 RedHat       6 RedHat  LINUX
  INTEL  LINUX   RedHat6      607 RedHat       6 RedHat  LINUX
  X86_64 LINUX   RedHat7      702 RedHat       7 RedHat  LINUX
  X86_64 WINDOWS WINDOWS601   601 Windows7   601 Win7    WINNT61
  X86_64 WINDOWS WINDOWS602   602 Windows8   602 Win8    WINNT62
  X86_64 WINDOWS WINDOWS1000 1000 Windows10 1000 Win10   WINNT100
  X86_64 OSX     MacOSX7      705 Lion         7 MacOSX  OSX
  X86_64 OSX     MacOSX8      805 MountainLion 8 MacOSX  OSX
  X86_64 OSX     MacOSX10    1001 ElCapitan   10 MacOSX  OSX
  X86_64 OSX     MacOSX10    1005 ElCapitan   10 MacOSX  OSX
  X86_64 LINUX   Ubuntu12    1204 Ubuntu      12 Ubuntu  LINUX
  X86_64 LINUX   Ubuntu14    1404 Ubuntu      14 Ubuntu  LINUX
  X86_64 LINUX   Fedora23    2300 Fedora      23 Fedora  LINUX
  X86_64 LINUX   Fedora24    2200 Fedora      22 Fedora  LINUX
  X86_64 FREEBSD FreeBSD10   1003 FreeBSD     10 FreeBSD FREEBSD
)