Changeset 18923 for branches/eam_branch_20080719/ippTools/src/difftool.c
- Timestamp:
- Aug 5, 2008, 2:07:07 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branch_20080719/ippTools/src/difftool.c
r18659 r18923 652 652 653 653 // Generate a single populated run 654 static bool populatedrun(const char *workdir, // Working directory 654 static bool populatedrun(psArray *list, // List of runs, to print 655 const char *workdir, // Working directory 655 656 const char *skycell_id, // Skycell identifier 656 657 const char *tess_id, // Tessellation identifier … … 759 760 } 760 761 761 if (!diffRunPrintObject(stdout, run, !simple)) { 762 psError(PS_ERR_UNKNOWN, false, "failed to print object"); 763 psFree(run); 764 return false; 762 if (list) { 763 psArrayAdd(list, list->n, run); 765 764 } 766 765 … … 782 781 PXOPT_LOOKUP_S64(input_warp_id, config->args, "-input_warp_id", false, false); 783 782 PXOPT_LOOKUP_S64(input_stack_id, config->args, "-input_stack_id", false, false); 783 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 784 784 785 785 if (template_stack_id && template_warp_id) { … … 803 803 } 804 804 805 return populatedrun(workdir, skycell_id, tess_id, 806 input_warp_id ? input_warp_id : PS_MAX_S64, 807 input_stack_id ? input_stack_id : PS_MAX_S64, 808 template_warp_id ? template_warp_id : PS_MAX_S64, 809 template_stack_id ? template_stack_id : PS_MAX_S64, 810 config); 805 psArray *list = psArrayAllocEmpty(16); // List of runs, to print 806 807 if (!populatedrun(list, workdir, skycell_id, tess_id, 808 input_warp_id ? input_warp_id : PS_MAX_S64, 809 input_stack_id ? input_stack_id : PS_MAX_S64, 810 template_warp_id ? template_warp_id : PS_MAX_S64, 811 template_stack_id ? template_stack_id : PS_MAX_S64, 812 config)) { 813 psError(PS_ERR_UNKNOWN, false, "failed to create populated diffRun"); 814 psFree(list); 815 return false; 816 } 817 818 if (!diffRunPrintObjects(stdout, list, !simple)) { 819 psError(PS_ERR_UNKNOWN, false, "failed to print object"); 820 psFree(list); 821 return false; 822 } 823 psFree(list); 811 824 812 825 return true; … … 820 833 psMetadata *where = psMetadataAlloc(); 821 834 822 PXOPT_COPY_S64(config->args, where, "-diff_id", "diff_id", "==");823 835 PXOPT_COPY_S64(config->args, where, "-warp_id", "warp_id", "=="); 824 836 PXOPT_COPY_STR(config->args, where, "-skycell_id", "skycell_id", "=="); 825 PXOPT_COPY_STR(config->args, where, "-tess_id", "tess_id", "=="); 837 PXOPT_COPY_STR(config->args, where, "-tess_id", "tess_id", "=="); 838 PXOPT_COPY_STR(config->args, where, "-filter", "filter", "=="); 826 839 PXOPT_COPY_STR(config->args, where, "-kind", "kind", "=="); 840 PXOPT_COPY_F32(config->args, where, "-good_frac", "good_frac", ">="); 827 841 PXOPT_LOOKUP_STR(workdir, config->args, "-workdir", true, false); // required options 828 842 PXOPT_LOOKUP_TIME(registered, config->args, "-registered", false, false); 829 PXOPT_LOOKUP_BOOL(template, config->args, "-template", false);830 843 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 844 PXOPT_LOOKUP_BOOL(newTemplates, config->args, "-new-templates", false); 831 845 832 846 // find all things to queue 833 psString query = pxDataGet("difftool_ queue.sql");847 psString query = pxDataGet("difftool_definebyquery.sql"); 834 848 if (!query) { 835 849 psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement"); … … 837 851 } 838 852 839 if ( template) {840 // list only faulted rows841 psStringAppend(&query, " %s", " AND diffInputSkyfile.template != 0");853 if (newTemplates) { 854 // Warps that haven't been diffed OR warps that can take a newer template in the diff 855 psStringAppend(&query, " WHERE (diff_id IS NULL OR best_stack_id > current_stack_id)"); 842 856 } else { 843 // don't list faulted rows 844 psStringAppend(&query, " %s", 845 " AND (diffInputSkyfile.template = 0 OR diffInputSkyfile.template IS NULL)"); 857 // Only warps that haven't been diffed 858 psStringAppend(&query, " WHERE diff_id IS NULL"); 846 859 } 847 860 848 861 if (psListLength(where->list)) { 849 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL);862 psString whereClause = psDBGenerateWhereConditionSQL(where, "warpsToDiff"); 850 863 psStringAppend(&query, " AND %s", whereClause); 851 864 psFree(whereClause); … … 880 893 } 881 894 895 psArray *list = psArrayAllocEmpty(16); // List of runs, to print 882 896 long numGood = 0; // Number of good rows added 883 897 for (long i = 0; i < output->n; i++) { … … 896 910 continue; 897 911 } 898 psS64 stack_id = psMetadataLookupS64(&mdok, row, " stack_id");912 psS64 stack_id = psMetadataLookupS64(&mdok, row, "best_stack_id"); 899 913 if (!mdok) { 900 914 psWarning("stack_id not found --- ignoring row %ld", i); … … 907 921 } 908 922 909 if (!populatedrun(workdir, skycell_id, tess_id, warp_id, PS_MAX_S64, PS_MAX_S64, stack_id, config)) { 923 if (!populatedrun(list, workdir, skycell_id, tess_id, warp_id, PS_MAX_S64, PS_MAX_S64, 924 stack_id, config)) { 910 925 psWarning("Unable to add run for %s,%s,%" PRId64 ",%" PRId64, skycell_id, tess_id, 911 926 warp_id, stack_id); … … 916 931 numGood++; 917 932 } 918 919 psLogMsg("difftool", PS_LOG_INFO, "%ld runs added.", numGood);920 921 933 psFree(output); 934 935 if (!diffRunPrintObjects(stdout, list, !simple)) { 936 psError(PS_ERR_UNKNOWN, false, "failed to print object"); 937 psFree(list); 938 return false; 939 } 940 psFree(list); 922 941 923 942 return true;
Note:
See TracChangeset
for help on using the changeset viewer.
