{"id":241,"date":"2017-05-25T14:32:29","date_gmt":"2017-05-25T13:32:29","guid":{"rendered":"http:\/\/ri.itservices.manchester.ac.uk\/htccondor\/?page_id=241"},"modified":"2019-07-04T16:45:57","modified_gmt":"2019-07-04T15:45:57","slug":"mod-job-param","status":"publish","type":"page","link":"https:\/\/ri.itservices.manchester.ac.uk\/htccondor\/jobs\/mod-job-param\/","title":{"rendered":"Modifying job parameters"},"content":{"rendered":"<h2>condor_submit: command line tricks with the -append argument<\/h2>\n<p>Apologies if you are a DropAndCompute user, but these tricks are Linux command line only.<\/p>\n<p>Condor_submit is normally used as simply as this:<\/p>\n<pre>condor_submit submit.txt\r\n<\/pre>\n<p>That is, a submit file is produced that fully describes the Condor submission. An alternative is to leave some lines out of the submit file and supply them on the command line using -append (or -a for short).<\/p>\n<h2>Example 1<\/h2>\n<p>A trivial example is where sometimes you want to be notified, by email, that your job has finished and sometimes you don\u2019t. The default when not specified in the submit file is that you do get an email notification. But, you could submit as follows:<\/p>\n<pre>condor_submit -a \"notifcation = never\" submit.txt\r\n<\/pre>\n<p>Logically the line is taken as coming just before the <code>Queue<\/code> line in <code>submit.txt<\/code>, at least one <code>Queue<\/code> line being mandatory.<\/p>\n<h2>Example 2<\/h2>\n<p>In this example we change the number of jobs queued dynamically; that is: we supply the details on the command line. Your <code>Queue<\/code> line in the submit file should be written like this:<\/p>\n<pre>Queue $(queuecount)\r\n<\/pre>\n<p>Do not define the macro queuecount in the submit file. Undefined macros default to the empty string, and so the above is equivalent to just<\/p>\n<pre>Queue\r\n<\/pre>\n<p>(which itself means Queue 1).<\/p>\n<p>When you have, say, finished testing and you want to queue 100 jobs, submit it this way:<\/p>\n<pre>condor_submit -a \"queuecount = 100\" submit.txt\r\n<\/pre>\n<p>Note the quotes around the -a(ppend) argument as it has spaces in it; It can also be written:<\/p>\n<pre>condor_submit -a queuecount=100 submit.txt\r\n<\/pre>\n<p>equivalently. Thanks to Matt Farrellee of Red Hat for this tip. Matt also supplied the next one.<\/p>\n<h2>Example 3<\/h2>\n<p>What if you have lots of little files to transfer, and they come and go during your work flow. Let\u2019s say they all end in .data, and you would like to write in your submit file:<\/p>\n<pre>transfer_input_files = *.data\r\n<\/pre>\n<p>but you can\u2019t. Again, the command line -append trick comes to the rescue:<\/p>\n<pre>condor_submit -a \"transfer_input_files = mycode.sh$(for i in *.data; do echo -n \",$i\"; done)\" submit.txt\r\n<\/pre>\n<p>Note that no <code>transfer_input_files<\/code> line should be used in the submit file. Also, a comma is already provided by the for loop so one isn&#8217;t required straight after the first input file.<\/p>\n<h2>Example 4<\/h2>\n<p>This one is a little similar to Example 2 in that you may have different submissions for different purposes: test versus production; or just differing data sets. The idea here is that you switch sub-directory on submission, like so:<\/p>\n<pre>condor_submit -a \"initialdir = Test\" submit.txt\r\n<\/pre>\n<p>An additional issue encountered here is that it&#8217;s likely the original Condor submit file and your executable code are back in the previous directory. It is also possible to script this to allow the submission of a large array of data sets at the same time. A script which achieves this is as follows<\/p>\n<pre>#!\/bin\/bash\r\n\r\nBASE_DIR='\/home\/[your_UoM_username]\/[your_working_directory]'\r\nNUM_OF_INPUTS=2\r\n\r\nfor i in `eval echo {1..$NUM_OF_INPUTS}`\r\ndo\r\n    condor_submit -a \"transfer_input_files = $BASE_DIR\/mycode.sh,input.txt,$BASE_DIR\/myscript.sh$(for i2 in $BASE_DIR\/*.data; do echo -n \",$i2\"; done)\" -a \"initialdir = input$i\" $BASE_DIR\/submit.txt\r\ndone\r\n<\/pre>\n<p>For the above example to work, each of the new data sets needs placing in a directory called inputX, where X is an integer from 1 to the value set for &#8216;NUM_OF_INPUTS&#8217; provided in the above script. The script transfers the local copy of the file &#8216;input.txt&#8217; from the inputX directory into the executable being run by the executable line in the Condor submit file. It is assumed these are located directly within your main &#8216;BASE_DIR&#8217; directory.<\/p>\n<p>The &#8216;submit.txt&#8217; file contains, among other things<\/p>\n<pre>\r\nexecutable = \/home\/[your_UoM_username]\/[your_working_directory]\/condor_script.sh\r\n<\/pre>\n<p>Which is a direct reference to the file containing the actual executable\/script which references the &#8216;input.txt&#8217; as input to the main executable\/script<\/p>\n<pre>\r\n#!\/bin\/bash\r\n\r\n.\/my_main_script.sh -file input.txt\r\n<\/pre>\n<p>Each time a job is submitted to Condor via the first, master script the working directory is changed and the input.txt file used therein is then used as the input for the task being executed.<\/p>\n<h2>Example 5<\/h2>\n<p>Another simple example where we decide how we want matching machines to be ranked.<\/p>\n<pre>condor_submit -a \"rank = memory\" submit.txt # go with most memory first\r\n<\/pre>\n<p>or<\/p>\n<pre>condor_submit -a \"rank = kflops\" submit.txt # go with those fastest at floating point first\r\n<\/pre>\n<p>or<\/p>\n<pre>condor_submit -a \"rank = Target.TotalCPUs\" submit.txt # go with most cores first\r\n<\/pre>\n<p>Finally, note that you can add multiple lines with multiple -a (or -append) arguments.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>condor_submit: command line tricks with the -append argument Apologies if you are a DropAndCompute user, but these tricks are Linux command line only. Condor_submit is normally used as simply as this: condor_submit submit.txt That is, a submit file is produced that fully describes the Condor submission. An alternative is to leave some lines out of the submit file and supply them on the command line using -append (or -a for short). Example 1 A trivial.. <a href=\"https:\/\/ri.itservices.manchester.ac.uk\/htccondor\/jobs\/mod-job-param\/\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"parent":14,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-241","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/htccondor\/wp-json\/wp\/v2\/pages\/241","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/htccondor\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/htccondor\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/ri.itservices.manchester.ac.uk\/htccondor\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ri.itservices.manchester.ac.uk\/htccondor\/wp-json\/wp\/v2\/comments?post=241"}],"version-history":[{"count":20,"href":"https:\/\/ri.itservices.manchester.ac.uk\/htccondor\/wp-json\/wp\/v2\/pages\/241\/revisions"}],"predecessor-version":[{"id":982,"href":"https:\/\/ri.itservices.manchester.ac.uk\/htccondor\/wp-json\/wp\/v2\/pages\/241\/revisions\/982"}],"up":[{"embeddable":true,"href":"https:\/\/ri.itservices.manchester.ac.uk\/htccondor\/wp-json\/wp\/v2\/pages\/14"}],"wp:attachment":[{"href":"https:\/\/ri.itservices.manchester.ac.uk\/htccondor\/wp-json\/wp\/v2\/media?parent=241"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}