Skip to content

Commit

Permalink
move training to use condor, not openlava
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason Coposky committed Nov 29, 2016
1 parent d767470 commit ce9e2c1
Show file tree
Hide file tree
Showing 7 changed files with 90 additions and 4 deletions.
11 changes: 11 additions & 0 deletions advanced/create_thumbnails.r
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
create_thumbnails {

*err = errormsg(create_thumbnail_collection(*src_obj_path, *dst_phy_dir), *msg)
if(0 != *err) {
writeLine( "stdout", "FAIL: [*err] [*msg]")
}
}

INPUT *src_obj_path="/tempZone/home/rods/stickers.jpg",*dst_phy_dir="/tmp/irods/thumbnails"
OUTPUT ruleExecOut

16 changes: 16 additions & 0 deletions advanced/find_thumbnails.r
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
find_thumbnails {
*thb_list = list()

*err = errormsg(get_list_of_thumbnails(*src_obj_path, *thb_list), *msg)
if(0 != *err) {
writeLine( "stdout", "FAIL: [*err] [*msg]")
}

foreach( *t in *thb_list ) {
writeLine("stdout", "thumbnail [*t]")
}

}

INPUT *src_obj_path="/tempZone/home/rods/stickers.jpg"
OUTPUT ruleExecOut
17 changes: 17 additions & 0 deletions advanced/submit_thumbnail_job.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

# $1 - sizing string
# $2 - source physical path
# $3 - destiation physical path

/usr/bin/condor_submit /var/lib/irods/msiExecCmd_bin/thumbnail.submit -append "executable ${1}" -append "arguments ${2} ${3} ${4} ${5}"

# debug only
#echo ${1}
#echo ${2}
#echo ${3}
#echo ${4}
#echo ${5}
#echo "return code is $?"
#exit 0

29 changes: 29 additions & 0 deletions advanced/thumbnail.re
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,35 @@ create_thumbnail_impl(

}

get_list_of_thumbnails(
*src_obj_path,
*thumbnail_list ) {

*thumbnail_list = list()
split_path(*src_obj_path, "/", *col_name, *obj_name)

# derive a collection name from the logical path
*thumb_coll_name = "NULL"
get_thumbnail_collection_name(*col_name, *obj_name, *thumb_coll_name);
writeLine( "serverLog", "XXXX - get_list_of_thumbnails :: thumb_coll_name [*thumb_coll_name]" )

# get the list of possible sizes
get_thumbnail_sizes(*thumb_sizes)
foreach( *sz in *thumb_sizes ) {
get_thumbnail_name(*obj_name, *sz, *thumbnail_name);
*dst_obj_path = *thumb_coll_name ++ "/" ++ *thumbnail_name
writeLine( "serverLog", "XXXX - get_list_of_thumbnails :: [*src_obj_path] [*sz] [*thumbnail_name] [*dst_obj_path]" )

# does the thumbnail exist
*err = errormsg(msiObjStat(*dst_obj_path,*obj_stat), *msg);
if( 0 == *err ) {
# it does exist, add it to the list
*thumbnail_list = cons(*dst_obj_path, *thumbnail_list)
}
}
}


create_thumbnail(
*src_obj_path,
*dst_obj_path,
Expand Down
5 changes: 5 additions & 0 deletions advanced/thumbnail.submit
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

executable = /usr/bin/jeb
universe = vanilla

queue
16 changes: 12 additions & 4 deletions advanced/thumbnail_configuration.re
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,20 @@ submit_thumbnail_job(
*src_phy_path,
*dst_phy_path ) {
remote(*server_host, "") {
*cmd_opt = 'convert -thumbnail *size_str *src_phy_path *dst_phy_path'
*err = errormsg(msiExecCmd("submit_job.sh", *cmd_opt, "", "", "", *std_out_err), *msg);
if(*err != 0) {
*cmd_opt = '/usr/bin/convert -thumbnail *size_str *src_phy_path *dst_phy_path'
*err = errormsg(msiExecCmd("submit_thumbnail_job.sh", *cmd_opt, "null", "null", "null", *std_out_err), *msg);

msiGetStdoutInExecCmdOut(*std_out_err,*std_out);
writeLine("serverLog", "XXXX - STDOUT [*std_out]")

msiGetStderrInExecCmdOut(*std_out_err,*std_err);
writeLine("serverLog", "XXXX - STDERR [*std_err]")

if(*err != 0) {
writeLine( "serverLog", "FAILED: [*cmd_opt] [*err] [*msg]" );
failmsg(*err,*cmd_opt)
}

} # remote
}

Expand All @@ -41,7 +49,7 @@ get_thumbnail_physical_path(*dst_dir, *thumb_name, *phy_path) {
}

get_thumbnail_name(*file_name, *size, *thumb_name) {
# triim the extension
# trim the extension
*fn = trimr(*file_name, ".")
*ext = substr(*file_name, strlen(*fn)+1, strlen(*file_name))
*thumb_name = *fn ++ "_thumbnail_" ++ *size ++ "." ++ *ext
Expand Down
Binary file added stickers.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ce9e2c1

Please sign in to comment.