[Swift-commit] r2865 - SwiftApps/pc3
noreply at svn.ci.uchicago.edu
noreply at svn.ci.uchicago.edu
Tue Apr 21 09:06:00 CDT 2009
Author: benc
Date: 2009-04-21 09:06:00 -0500 (Tue, 21 Apr 2009)
New Revision: 2865
Modified:
SwiftApps/pc3/pc3.swift
Log:
make pc3.swift more swiftier
Modified: SwiftApps/pc3/pc3.swift
===================================================================
--- SwiftApps/pc3/pc3.swift 2009-04-21 07:54:04 UTC (rev 2864)
+++ SwiftApps/pc3/pc3.swift 2009-04-21 14:06:00 UTC (rev 2865)
@@ -1,6 +1,9 @@
type xmlfile;
type textfile;
+(external out) checkvalid(boolean b) {
+ if(!b) { stop(); }
+}
(xmlfile output) ps_load_executable(xmlfile input, string s) {
app {
@@ -8,6 +11,13 @@
}
}
+(xmlfile output) ps_load_executable_threaded(xmlfile input, string s, external thread) {
+ app {
+ ps_load_executable_app @input s @output;
+ }
+}
+
+
(textfile output) parse_xml_boolean_value(xmlfile input) {
app {
parse_xml_boolean_value_app @input @output;
@@ -36,7 +46,8 @@
output = ps_load_executable_boolean(input, "IsMatchCSVFileTables");
}
-(xmlfile output) create_empty_load_db(xmlfile input) {
+// TODO I think this output never gets used?
+(xmlfile output, external outthread) create_empty_load_db(xmlfile input) {
output = ps_load_executable(input, "CreateEmptyLoadDB");
}
@@ -56,42 +67,43 @@
output = ps_load_executable_boolean(input, "IsExistsCSVFile");
}
-(xmlfile output) read_csv_file_column_names(xmlfile input) {
- output = ps_load_executable(input, "ReadCSVFileColumnNames");
+(xmlfile output) read_csv_file_column_names(xmlfile input, external thread) {
+ output = ps_load_executable_threaded(input, "ReadCSVFileColumnNames", thread);
}
(boolean output) is_match_csv_file_column_names(xmlfile input) {
output = ps_load_executable_boolean(input, "IsMatchCSVFileColumnNames");
}
-(xmlfile output) ps_load_executable_db (xmlfile db, xmlfile input, string s) {
+(xmlfile output) ps_load_executable_db (xmlfile db, xmlfile input, string s, external thread) {
app {
ps_load_executable_db_app @db @input s @output;
}
}
-(boolean output) ps_load_executable_db_boolean(xmlfile db, xmlfile input, string s) {
- xmlfile xml_out = ps_load_executable_db(db, input, s);
+(boolean output) ps_load_executable_db_boolean(xmlfile db, xmlfile input, string s, external thread) {
+ xmlfile xml_out = ps_load_executable_db(db, input, s, thread);
output = extract_boolean(xml_out);
}
-(boolean output) load_csv_file_into_table(xmlfile db, xmlfile input) {
- output = ps_load_executable_db_boolean(db, input, "LoadCSVFileIntoTable");
+(boolean output) load_csv_file_into_table(xmlfile db, xmlfile input, external thread) {
+ output = ps_load_executable_db_boolean(db, input, "LoadCSVFileIntoTable", thread);
}
-(boolean output) update_computed_columns(xmlfile db, xmlfile input) {
- output = ps_load_executable_db_boolean(db, input, "UpdateComputedColumns");
+(boolean output) update_computed_columns(xmlfile db, xmlfile input, external thread) {
+ output = ps_load_executable_db_boolean(db, input, "UpdateComputedColumns", thread);
}
-(boolean output) is_match_table_row_count(xmlfile db, xmlfile input) {
- output = ps_load_executable_db_boolean(db, input, "IsMatchTableRowCount");
+(boolean output) is_match_table_row_count(xmlfile db, xmlfile input, external thread) {
+ output = ps_load_executable_db_boolean(db, input, "IsMatchTableRowCount", thread);
}
-(boolean output) is_match_table_column_ranges(xmlfile db, xmlfile input) {
- output = ps_load_executable_db_boolean(db, input, "IsMatchTableColumnRanges");
+(boolean output) is_match_table_column_ranges(xmlfile db, xmlfile input, external thread) {
+ output = ps_load_executable_db_boolean(db, input, "IsMatchTableColumnRanges", thread);
}
-compact_database (xmlfile input) {
+// TODO what is the input used for here?
+compact_database (xmlfile input, external thread) {
app {
compact_database_app @input;
}
@@ -116,11 +128,12 @@
is_csv_ready_file_exists_output = is_csv_ready_file_exists(csv_root_path_input);
-if(is_csv_ready_file_exists_output) {
read_csv_ready_file_output = read_csv_ready_file(csv_root_path_input);
is_match_csv_file_tables_output = is_match_csv_file_tables(read_csv_ready_file_output);
if(is_match_csv_file_tables_output) {
- create_empty_load_db_output = create_empty_load_db(job_id);
+ external db_over_time[];
+ external dbinit; // some bug in analysis means can't use db_over_time for initial one
+ (create_empty_load_db_output, dbinit) = create_empty_load_db(job_id);
count_entries_output = count_entries(read_csv_ready_file_output);
entries = readData(count_entries_output);
int entries_seq[] = [1:entries];
@@ -128,9 +141,11 @@
foreach i in entries_seq {
split_list_output[i] = extract_entry(read_csv_ready_file_output, i);
}
-
- iterate i {
-
+
+
+// TODO this can merge with merge with above foreach
+
+ foreach i in entries_seq {
boolean is_exists_csv_file_output;
xmlfile read_csv_file_column_names_output;
boolean is_match_csv_file_column_names_output;
@@ -139,48 +154,27 @@
boolean is_match_table_row_count_output;
boolean is_match_table_column_ranges_output;
- is_exists_csv_file_output = is_exists_csv_file(split_list_output[i+1]);
- if(is_exists_csv_file_output) {
- read_csv_file_column_names_output = read_csv_file_column_names(split_list_output[i+1]);
- is_match_csv_file_column_names_output = is_match_csv_file_column_names(read_csv_file_column_names_output);
- if(is_match_csv_file_column_names_output) {
- load_csv_file_into_table_output = load_csv_file_into_table(create_empty_load_db_output, read_csv_file_column_names_output);
- if(load_csv_file_into_table_output) {
- update_computed_columns_output = update_computed_columns(create_empty_load_db_output, read_csv_file_column_names_output);
- if(update_computed_columns_output) {
- is_match_table_row_count_output = is_match_table_row_count(create_empty_load_db_output, read_csv_file_column_names_output);
- if(is_match_table_row_count_output) {
- is_match_table_column_ranges_output = is_match_table_column_ranges(create_empty_load_db_output, read_csv_file_column_names_output);
- if(!is_match_table_column_ranges_output) {
- stop();
- }
- }
- else {
- stop();
- }
- }
- else {
- stop();
- }
- }
- else {
- stop();
- }
- }
- else {
- stop();
- }
+ is_exists_csv_file_output = is_exists_csv_file(split_list_output[i]);
+ external thread6 = checkvalid(is_exists_csv_file_output);
+read_csv_file_column_names_output = read_csv_file_column_names(split_list_output[i], thread6);
+ is_match_csv_file_column_names_output = is_match_csv_file_column_names(read_csv_file_column_names_output);
+ external thread2 = checkvalid(is_match_csv_file_column_names_output);
+
+ if(i==1) { // first element...
+ load_csv_file_into_table_output = load_csv_file_into_table(create_empty_load_db_output, read_csv_file_column_names_output, dbinit);
+ } else {
+ load_csv_file_into_table_output = load_csv_file_into_table(create_empty_load_db_output, read_csv_file_column_names_output, db_over_time[i]);
}
- else {
- stop();
- }
- } until ((i + 2) > entries);
- compact_database(create_empty_load_db_output);
+ external thread3=checkvalid(load_csv_file_into_table_output);
+ update_computed_columns_output = update_computed_columns(create_empty_load_db_output, read_csv_file_column_names_output, thread3);
+ external thread4 = checkvalid(update_computed_columns_output);
+ is_match_table_row_count_output = is_match_table_row_count(create_empty_load_db_output, read_csv_file_column_names_output, thread4);
+ external thread1 = checkvalid(is_match_table_row_count_output);
+ is_match_table_column_ranges_output = is_match_table_column_ranges(create_empty_load_db_output, read_csv_file_column_names_output, thread1);
+ db_over_time[i+1] = checkvalid(is_match_table_column_ranges_output);
+ }
+ compact_database(create_empty_load_db_output, db_over_time[entries+1]);
}
else {
stop();
}
-}
-else {
- stop();
-}
More information about the Swift-commit
mailing list