Skip to content

Commit 508d31e

Browse files
authored
Merge pull request #36 from srlearn/condor
🔥 Drop `condor.chirp`
2 parents 2eb4db2 + 25a6639 commit 508d31e

12 files changed

+15
-702
lines changed

src/main/java/edu/wisc/cs/will/Utils/Utils.java

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -251,16 +251,7 @@ public static String limitLengthOfPrintedList(Map<?, ?> map) {
251251
* Save some typing when throwing generic errors.
252252
*/
253253
public static void error(String msg) {
254-
if ( CondorUtilities.isCondor() ) {
255-
System.err.println("\nERROR: " + msg);
256-
// Nice to print the calling stack so one can see what caused the error ...
257-
// Doing it this way puts the stack in the ERROR file.
258-
(new Exception()).printStackTrace();
259-
println("\n" + msg);
260-
println("\nSince this is a condor job, will exit.");
261-
cleanupAndExit();
262-
}
263-
throw new WILLthrownError("\n " + msg);
254+
throw new WILLthrownError("\n " + msg);
264255
}
265256
public static void error() {
266257
throw new WILLthrownError("\n Should not happen ...");
@@ -450,9 +441,6 @@ public static void waitHere(String msg) {
450441
print("\n% WaitHere: " + msg + "\n% ... Hit ENTER to continue or 'e' to interrupt. ", false);
451442
doNotPrintToSystemDotOut = hold;
452443

453-
if ( CondorUtilities.isCondor() ) {
454-
error("\nSince this is a condor job, will exit.");
455-
}
456444
try {
457445
if (inBufferedReader == null) { inBufferedReader = new BufferedReader(new InputStreamReader(System.in)); }
458446
String readThis = inBufferedReader.readLine();

src/main/java/edu/wisc/cs/will/Utils/condor/CompressedOutputStream.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*/
1111
public class CompressedOutputStream extends OutputStream {
1212

13-
private OutputStream realStream;
13+
private final OutputStream realStream;
1414

1515
public CompressedOutputStream(String fileName, boolean compressOutput) throws IOException {
1616
this(new File(fileName), compressOutput);

src/main/java/edu/wisc/cs/will/Utils/condor/CondorFile.java

Lines changed: 4 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,15 @@
11
package edu.wisc.cs.will.Utils.condor;
22

33
import edu.wisc.cs.will.Utils.Utils;
4-
import edu.wisc.cs.will.Utils.condor.chirp.ChirpClient;
54

65
import java.io.File;
7-
import java.io.FileNotFoundException;
86
import java.io.IOException;
9-
import java.util.logging.Level;
10-
import java.util.logging.Logger;
117

128
/*
139
* @author twalker
1410
*/
1511
public class CondorFile extends File {
1612

17-
private static ChirpClient chirpClient;
18-
1913
static {
2014
setupChirp();
2115
}
@@ -33,188 +27,90 @@ public CondorFile(String pathname) {
3327
}
3428

3529
private static void setupChirp() {
36-
if (CondorUtilities.isChirp()) {
37-
try {
38-
chirpClient = new ChirpClient();
39-
} catch (IOException ex) {
40-
Logger.getLogger(CondorFile.class.getName()).log(Level.SEVERE, null, ex);
41-
}
42-
}
4330
}
4431

4532
@Override
4633
public boolean canExecute() {
47-
if (chirpClient != null) {
48-
throw new UnsupportedOperationException("Unsupported by Condor/Chirp.");
49-
}
5034
return super.canExecute();
5135
}
5236

5337
@Override
5438
public boolean canRead() {
55-
if (chirpClient != null) {
56-
throw new UnsupportedOperationException("Unsupported by Condor/Chirp.");
57-
}
5839
return super.canRead();
5940
}
6041

6142
@Override
6243
public boolean canWrite() {
63-
if (chirpClient != null) {
64-
throw new UnsupportedOperationException("Unsupported by Condor/Chirp.");
65-
}
6644
return super.canWrite();
6745
}
6846

6947
@Override
7048
public boolean createNewFile() throws IOException {
71-
if (chirpClient != null) {
72-
throw new UnsupportedOperationException("Unsupported by Condor/Chirp.");
73-
}
7449
return super.createNewFile();
7550
}
7651

7752
@Override
7853
public boolean delete() {
79-
if (chirpClient != null) {
80-
try {
81-
if ( exists() ) {
82-
chirpClient.unlink(getPath());
83-
return true;
84-
}
85-
} catch (IOException ex) {
86-
throw new RuntimeException("Condor/Chirp error deleting file " + getPath() + ":" + ex.toString());
87-
}
88-
return false;
89-
}
90-
else {
91-
return super.delete();
92-
}
54+
return super.delete();
9355
}
9456

9557
@Override
9658
public boolean exists() {
97-
if (chirpClient != null) {
98-
99-
try {
100-
CondorFileInputStream is = new CondorFileInputStream(this);
101-
try {
102-
is.close();
103-
} catch (IOException ignored) {
104-
}
105-
return true;
106-
107-
} catch (FileNotFoundException fileNotFoundException) {
108-
return false;
109-
}
110-
}
111-
else {
112-
return super.exists();
113-
}
59+
return super.exists();
11460
}
11561

11662
@Override
11763
public long getTotalSpace() {
118-
if (chirpClient != null) {
119-
throw new UnsupportedOperationException("Unsupported by Condor/Chirp.");
120-
}
12164
return super.getTotalSpace();
12265
}
12366

12467
@Override
12568
public long getUsableSpace() {
126-
if (chirpClient != null) {
127-
throw new UnsupportedOperationException("Unsupported by Condor/Chirp.");
128-
}
12969
return super.getUsableSpace();
13070
}
13171

13272
@Override
13373
public boolean isDirectory() {
134-
if (chirpClient != null) {
135-
throw new UnsupportedOperationException("Unsupported by Condor/Chirp.");
136-
}
13774
return super.isDirectory();
13875
}
13976

14077
@Override
14178
public boolean isFile() {
142-
if (chirpClient != null) {
143-
throw new UnsupportedOperationException("Unsupported by Condor/Chirp.");
144-
}
14579
return super.isFile();
14680
}
14781

14882
@Override
14983
public long lastModified() {
150-
if (chirpClient != null) {
151-
throw new UnsupportedOperationException("Unsupported by Condor/Chirp.");
152-
}
15384
return super.lastModified();
15485
}
15586

15687
@Override
15788
public long length() {
158-
if (chirpClient != null) {
159-
throw new UnsupportedOperationException("Unsupported by Condor/Chirp.");
160-
}
16189
return super.length();
16290
}
16391

16492
@Override
16593
public String[] list() {
166-
if (chirpClient != null) {
167-
throw new UnsupportedOperationException("Unsupported by Condor/Chirp.");
168-
}
16994
return super.list();
17095
}
17196

17297
@Override
17398
public File[] listFiles() {
174-
if (chirpClient != null) {
175-
throw new UnsupportedOperationException("Unsupported by Condor/Chirp.");
176-
}
17799
return super.listFiles();
178100
}
179101

180102
@Override
181103
public boolean mkdir() {
182-
if (chirpClient != null) {
183-
try {
184-
chirpClient.mkdir(getPath());
185-
return true;
186-
} catch (IOException ex) {
187-
throw new RuntimeException("Condor/Chirp failed to create " + getPath() + ".");
188-
}
189-
}
190-
else {
191-
return super.mkdir();
192-
}
104+
return super.mkdir();
193105
}
194106

195107
@Override
196108
public boolean mkdirs() {
197-
if (chirpClient != null) {
198-
if (!exists()) {
199-
String parentString = getParent();
200-
if (parentString != null) {
201-
File parent = new CondorFile(parentString);
202-
parent.mkdirs();
203-
}
204-
205-
mkdir();
206-
}
207-
208-
return true;
209-
}
210-
return super.mkdirs();
109+
return super.mkdirs();
211110
}
212111

213112
@Override
214113
public boolean renameTo(File dest) {
215-
if (chirpClient != null) {
216-
throw new UnsupportedOperationException("Unsupported by Condor/Chirp.");
217-
}
218114
return super.renameTo(dest);
219115
}
220116

src/main/java/edu/wisc/cs/will/Utils/condor/CondorFileInputStream.java

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package edu.wisc.cs.will.Utils.condor;
22

33
import edu.wisc.cs.will.Utils.Utils;
4-
import edu.wisc.cs.will.Utils.condor.chirp.ChirpInputStream;
54

65
import java.io.*;
76

@@ -10,35 +9,15 @@
109
*/
1110
public class CondorFileInputStream extends InputStream {
1211

13-
private InputStream stream;
12+
private final InputStream stream;
1413

1514
public CondorFileInputStream(File file) throws FileNotFoundException {
16-
if (CondorUtilities.isChirp()) {
17-
try {
18-
stream = new ChirpInputStream(file.toString());
19-
} catch (IOException ex) {
20-
Utils.waitHere("Error opening Condor chirp stream for " + file + ".");
21-
stream = null;
22-
}
23-
}
24-
else {
25-
stream = new FileInputStream(file);
26-
}
15+
stream = new FileInputStream(file);
2716
}
2817

2918
public CondorFileInputStream(String fileName) throws FileNotFoundException {
3019

31-
if (CondorUtilities.isChirp()) {
32-
try {
33-
stream = new ChirpInputStream(Utils.replaceWildCards(fileName));
34-
} catch (IOException ex) {
35-
Utils.waitHere("Error opening Condor chirp stream for " + Utils.replaceWildCards(fileName) + ".");
36-
stream = null;
37-
}
38-
}
39-
else {
40-
stream = new FileInputStream(Utils.replaceWildCards(fileName));
41-
}
20+
stream = new FileInputStream(Utils.replaceWildCards(fileName));
4221
}
4322

4423
public long skip(long n) throws IOException {

src/main/java/edu/wisc/cs/will/Utils/condor/CondorFileOutputStream.java

Lines changed: 4 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package edu.wisc.cs.will.Utils.condor;
22

33
import edu.wisc.cs.will.Utils.Utils;
4-
import edu.wisc.cs.will.Utils.condor.chirp.ChirpOutputStream;
54

65
import java.io.*;
76

@@ -13,61 +12,21 @@ public class CondorFileOutputStream extends OutputStream {
1312
private OutputStream stream;
1413

1514
public CondorFileOutputStream(File file) throws FileNotFoundException {
16-
if (CondorUtilities.isChirp()) {
17-
try {
18-
stream = new ChirpOutputStream(file.toString());
19-
} catch (IOException ex) {
20-
stream = null;
21-
throw new FileNotFoundException(ex.getMessage());
22-
}
23-
}
24-
else {
25-
stream = new FileOutputStream(file);
26-
}
15+
stream = new FileOutputStream(file);
2716
}
2817

2918
public CondorFileOutputStream(String fileName) throws FileNotFoundException {
3019

31-
if (CondorUtilities.isChirp()) {
32-
try {
33-
stream = new ChirpOutputStream(Utils.replaceWildCards(fileName));
34-
} catch (IOException ex) {
35-
stream = null;
36-
throw new FileNotFoundException(ex.getMessage());
37-
}
38-
}
39-
else {
40-
stream = new FileOutputStream(Utils.replaceWildCards(fileName));
41-
}
20+
stream = new FileOutputStream(Utils.replaceWildCards(fileName));
4221
}
4322

4423
public CondorFileOutputStream(File file, boolean append) throws FileNotFoundException {
45-
if (CondorUtilities.isChirp()) {
46-
try {
47-
stream = new ChirpOutputStream(file.toString(), append);
48-
} catch (IOException ex) {
49-
stream = null;
50-
throw new FileNotFoundException(ex.getMessage());
51-
}
52-
}
53-
else {
54-
stream = new FileOutputStream(file, append);
55-
}
24+
stream = new FileOutputStream(file, append);
5625
}
5726

5827
public CondorFileOutputStream(String fileName, boolean append) throws FileNotFoundException {
5928

60-
if (CondorUtilities.isChirp()) {
61-
try {
62-
stream = new ChirpOutputStream(Utils.replaceWildCards(fileName), append);
63-
} catch (IOException ex) {
64-
stream = null;
65-
throw new FileNotFoundException(ex.getMessage());
66-
}
67-
}
68-
else {
69-
stream = new FileOutputStream(Utils.replaceWildCards(fileName), append);
70-
}
29+
stream = new FileOutputStream(Utils.replaceWildCards(fileName), append);
7130
}
7231

7332
public void write(byte[] b, int off, int len) throws IOException {

src/main/java/edu/wisc/cs/will/Utils/condor/CondorFileReader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*/
1111
public class CondorFileReader extends Reader {
1212

13-
private Reader reader;
13+
private final Reader reader;
1414

1515
public CondorFileReader(File file) throws FileNotFoundException {
1616
reader = new InputStreamReader( new CondorFileInputStream(file));

src/main/java/edu/wisc/cs/will/Utils/condor/CondorFileWriter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*/
1111
public class CondorFileWriter extends Writer {
1212

13-
private Writer writer;
13+
private final Writer writer;
1414

1515
public CondorFileWriter(File file, boolean append) throws IOException {
1616
writer = new OutputStreamWriter( new CondorFileOutputStream(file, append));

0 commit comments

Comments
 (0)