Esempio n. 1
0
 def test_directory(self):
     d1 = MutableFile("mf_test/")
     self.assertEqual(os.path.exists(d1.get_name()), False)
     d1.touch()
     self.assertEqual(d1.exists(), True)
     self.assertEqual(os.path.exists(d1.get_name()), True)
     d1.rm()
     self.assertEqual(os.path.exists(d1.get_name()), False)
Esempio n. 2
0
 def test_file(self):
     f1 = MutableFile("file_1.root")
     self.assertEqual(os.path.exists(f1.get_name()), False)
     f1.touch()
     self.assertEqual(f1.exists(), True)
     self.assertEqual(os.path.exists(f1.get_name()), True)
     f1.rm()
     self.assertEqual(os.path.exists(f1.get_name()), False)
Esempio n. 3
0
 def test_append(self):
     f1 = MutableFile("file_2.txt")
     f1.touch()
     f1.append("123\n")
     with open(f1.get_name(), "r") as fhin:
         self.assertEqual(fhin.read(), "123\n")
     f1.rm()
Esempio n. 4
0
    INPUTFILENAMES=$3
    IFILE=$4
    # Make sure OUTPUTNAME doesn't have .root
    OUTPUTNAME=$(echo $OUTPUTNAME | sed 's/\.root//')
    echo $(( 2*$(cat $INPUTFILENAMES) )) > tmp.txt
    gfal-copy -p -f -t 4200 --verbose file://`pwd`/tmp.txt gsiftp://gftp.t2.ucsd.edu${OUTPUTDIR}/${OUTPUTNAME}_${IFILE}.txt --checksum ADLER32
    """)
    exefile.chmod("u+x")

    # Make a CondorTask (3 in total, one for each input)
    task = CondorTask(
        sample=ds,
        files_per_output=1,
        tag="v0",
        output_name="output.txt",
        executable=exefile.get_name(),
        condor_submit_params={"sites": "UAF,T2_US_UCSD,UCSB"},
        no_load_from_backup=
        True,  # for the purpose of the example, don't use a backup
    )
    do_cmd("rm -rf {0}".format(task.get_outputdir()))

    # Process and sleep until complete
    is_complete = False
    for t in [5.0, 5.0, 10.0, 15.0, 20.0]:
        task.process()
        print("Sleeping for {0} seconds".format(int(t)))
        time.sleep(t)
        is_complete = task.complete()
        if is_complete: break