[us-commits] r2834 - in trunk/programs: us_com_project us_xpn_viewer

svn at svn.aucsolutions.com svn at svn.aucsolutions.com
Wed Sep 25 01:35:37 MDT 2019


Author: alexey
Date: 2019-09-25 07:35:36 +0000 (Wed, 25 Sep 2019)
New Revision: 2834

Modified:
   trunk/programs/us_com_project/us_com_project_gui.cpp
   trunk/programs/us_com_project/us_com_project_gui.h
   trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.cpp
   trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.h
Log:
autoflow: updates for proper handling job reattachement, jumping back and forth to Manage Optima Runs, and premature job abortion when no data yet generated....



Modified: trunk/programs/us_com_project/us_com_project_gui.cpp
===================================================================
--- trunk/programs/us_com_project/us_com_project_gui.cpp	2019-09-22 14:56:01 UTC (rev 2833)
+++ trunk/programs/us_com_project/us_com_project_gui.cpp	2019-09-25 07:35:36 UTC (rev 2834)
@@ -175,6 +175,8 @@
    //connect( this, SIGNAL( clear_experiment( QString & ) ),  epanExp, SLOT( clear_experiment( QString & )  ) );
    connect( epanObserv, SIGNAL( close_everything() ), this, SLOT( close_all() ));
    connect( this, SIGNAL( reset_live_update() ),  epanObserv, SLOT( reset_live_update( )  ) );
+   connect( epanObserv, SIGNAL( processes_stopped() ), this, SLOT( liveupdate_stopped() ));
+   connect( epanObserv, SIGNAL( stop_nodata() ), this, SLOT( close_all() ));
    
    //connect( epanPostProd, SIGNAL( switch_to_analysis( QString &, QString &) ),  this, SLOT( switch_to_analysis( QString &, QString & )  ) );
    //connect( this, SIGNAL( pass_to_analysis( QString &, QString & ) ),   epanAnalysis, SLOT( do_analysis( QString &, QString & )  ) );
@@ -343,6 +345,7 @@
    connect( epanObserv, SIGNAL( close_everything() ), this, SLOT( close_all() ));
    connect( this, SIGNAL( reset_live_update() ),  epanObserv, SLOT( reset_live_update( )  ) );
    connect( epanObserv, SIGNAL( processes_stopped() ), this, SLOT( liveupdate_stopped() ));
+   connect( epanObserv, SIGNAL( stop_nodata() ), this, SLOT( close_all() ));
    
    connect( epanPostProd, SIGNAL( switch_to_editing( QString &, QString &) ),  this, SLOT( switch_to_editing( QString &, QString & )  ) );
    connect( this, SIGNAL( reset_lims_import() ),  epanPostProd, SLOT( reset_lims_import( )  ) );
@@ -1730,6 +1733,9 @@
    connect( sdiag, SIGNAL( close_program() ), this, SLOT( to_close_program()  ) );
 
    connect( sdiag, SIGNAL( liveupdate_processes_stopped() ), this, SLOT( processes_stopped_passed()  ) );
+
+   //ALEXEY: premature abortion with no data
+   connect( sdiag, SIGNAL( aborted_back_to_initAutoflow( ) ), this, SLOT( to_initAutoflow_xpnviewer ( ) ) );
    
    offset = 0;
    sdiag->move(offset, 2*offset);
@@ -1771,6 +1777,11 @@
     QWidget::resizeEvent(event);
 }
 
+void US_ObservGui::to_initAutoflow_xpnviewer ( void )
+{
+  emit stop_nodata();
+}
+
 void US_ObservGui::processes_stopped_passed( void )
 {
   emit processes_stopped(); 

Modified: trunk/programs/us_com_project/us_com_project_gui.h
===================================================================
--- trunk/programs/us_com_project/us_com_project_gui.h	2019-09-22 14:56:01 UTC (rev 2833)
+++ trunk/programs/us_com_project/us_com_project_gui.h	2019-09-25 07:35:36 UTC (rev 2834)
@@ -189,14 +189,16 @@
       void to_post_processing( QMap < QString, QString > & );
       void to_close_program( void );
       void reset_live_update( void );
-      void processes_stopped_passed( void ); 
+      void processes_stopped_passed( void );
+      void to_initAutoflow_xpnviewer ( void );
  signals:
       void to_xpn_viewer( QMap < QString, QString > & protocol_details );
       //void switch_to_post_processing( QString & currDir, QString & protocolName, QString & invID_passed, QString & correctRadii  );
       void switch_to_post_processing( QMap < QString, QString > &  );
       void close_everything( void );
       void reset_live_update_passed( void );
-      void processes_stopped( void ); 
+      void processes_stopped( void );
+      void stop_nodata( void );
 };
 
 

Modified: trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.cpp
===================================================================
--- trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.cpp	2019-09-22 14:56:01 UTC (rev 2833)
+++ trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.cpp	2019-09-25 07:35:36 UTC (rev 2834)
@@ -1597,14 +1597,14 @@
       //ok_msg_data->click();
 
       //ALEXEY: make sure ExpID is coupled to the RunID which is already in the autoflow DB
-      if ( !runID_passed.isEmpty() || runID_passed != "NULL" )
-	{
-	  if ( runID_passed.toInt() != RunID_to_retrieve.toInt() )
-	    {
-	      RunID_to_retrieve = runID_passed;
-	      qDebug() << "Correcting RunID to : " << RunID_to_retrieve;
-	    }
-	}
+      if ( runID_passed != "NULL" )
+       	{
+       	  if ( runID_passed.toInt() != RunID_to_retrieve.toInt() )
+       	    {
+       	      RunID_to_retrieve = runID_passed;
+       	      qDebug() << "Correcting RunID to : " << RunID_to_retrieve;
+       	    }
+       	}
 	
       
       //ALEXEY: need to update 'autoflow' table with the unique RunID_to_retrieve && Start Run Time fields !!!
@@ -2343,14 +2343,14 @@
 //   US_XpnRunRaw* lddiag = new US_XpnRunRaw( drDesc, runInfo );
 //    if ( lddiag->exec() == QDialog::Rejected )                    //ALEXEY need drDesc but do NOT need dialog
 //    {
-// DbgLv(1) << "RDa:  rtn fr XpnRunRaw dialog: CANCEL";
+// DbgLv(1) << "RDr:  rtn fr XpnRunRaw dialog: CANCEL";
 //       return;
 //    }
 
 //    // Restore area beneath dialog
 //    qApp->processEvents();
-// DbgLv(1) << "RDa:  rtn fr XpnRunRaw dialog";
-// DbgLv(1) << "RDa:   drDesc" << drDesc;
+// DbgLv(1) << "RDr:  rtn fr XpnRunRaw dialog";
+// DbgLv(1) << "RDr:   drDesc" << drDesc;
 
    // See if we need to fix the runID
 
@@ -2411,16 +2411,16 @@
    scanmask          += QString( sMasks ).mid( 2, 1 ) == "1" ? 2 : 0;
    scanmask          += QString( sMasks ).mid( 4, 1 ) == "1" ? 4 : 0;
    scanmask          += QString( sMasks ).mid( 6, 1 ) == "1" ? 8 : 0;
-DbgLv(1) << "RDa:     iRId" << iRunId << "sMsks scnmask" << sMasks << scanmask;
+DbgLv(1) << "RDr:     iRId" << iRunId << "sMsks scnmask" << sMasks << scanmask;
 
+ qDebug() << "RDr:     iRId" << iRunId << "sMsks scnmask" << sMasks << scanmask;
+
  //ALEXEY: maybe put in_reload_check_sysdata = true; and then false (after xpn_data->import_data( iRunId, scanmask ); )
  //in_reload_check_sysdata = true; //ALEXEY
-
-   xpn_data->import_data( iRunId, scanmask );                               // ALEXEY <-- actual data retreiving
-
+ xpn_data->import_data( iRunId, scanmask );                               // ALEXEY <-- actual data retreiving
    int ntsrows        = xpn_data->countOf( "scan_rows" );
-DbgLv(1) << "RDa:     ntsrows" << ntsrows;
-DbgLv(1) << "RDa:      knt(triple)   " << xpn_data->countOf( "triple"    );
+DbgLv(1) << "RDr:     ntsrows" << ntsrows;
+DbgLv(1) << "RDr:      knt(triple)   " << xpn_data->countOf( "triple"    );
  qApp->processEvents();
 
    if ( ntsrows < 1 )
@@ -2429,6 +2429,41 @@
                           .arg( fRunId ) );
 
       in_reload_all_data   = false;  
+      
+      //ALEXEY: rare case when no data but exp. aborted !!!! 
+      if ( CheckExpComplete_auto( RunID_to_retrieve ) == 0 ) //ALEXEY should be == 3 as per documentation
+	{
+	  if ( finishing_live_update )
+	    {
+	      timer_all_data_avail->stop();
+	      disconnect(timer_all_data_avail, SIGNAL(timeout()), 0, 0);   //Disconnect timer from anything
+	      in_reload_all_data   = false;  
+	      return;
+	    }
+	  
+	  qDebug() << "ABORTION IN EARLY STAGE...";
+	  
+	  experimentAborted  = true;
+	  
+	  timer_all_data_avail->stop();
+	  disconnect(timer_all_data_avail, SIGNAL(timeout()), 0, 0);   //Disconnect timer from anything
+	  
+	  if ( !timer_check_sysdata->isActive()  ) // Check if sys_data Timer is stopped
+	    {
+	      //message on aborted run with no data
+	      QMessageBox::warning( this,
+				    tr( "Run Was Aborted" ),
+				    tr( "No data were produced. The current run will be erased. The program will return to the list of Optima runs..." ));
+	      
+	      delete_autoflow_record(); 
+	      reset_auto();
+	      
+	      in_reload_all_data   = false;  
+	      emit aborted_back_to_initAutoflow( );
+	      return;
+	    }
+	}
+      
       return;
    }
 
@@ -2474,80 +2509,65 @@
       drtype2            = ( runType2 == "RI" ) ? "Absorbance"   : drtype2;
       drtype2            = ( runType2 == "FI" ) ? "Fluorescence" : drtype2;
       drtype2            = ( runType2 == "WI" ) ? "Wavelength"   : drtype2;
+      opsys << drtype1 << drtype2;
+
       QString msg        = tr( "Multiple scan data types are present:\n" )
                            +   "'" + drtype1 + "'\n or \n"
-                           +   "'" + drtype2 + "' .\n";
-DbgLv(1) << "RDa:   runType2 scanmask" << runType2 << scanmask << "[ifw]scn_rows"
- << xpn_data->countOf( "iscn_rows" )
- << xpn_data->countOf( "fscn_rows" )
- << xpn_data->countOf( "wscn_rows" );
-      if ( ( runType2 == "IP"  &&  xpn_data->countOf( "iscn_rows" ) == 0 )  ||
-           ( runType2 == "FI"  &&  xpn_data->countOf( "fscn_rows" ) == 0 )  ||
-           ( runType2 == "WI"  &&  xpn_data->countOf( "wscn_rows" ) == 0 ) )
-      {
-         msg               += tr( "\nScans are missing so only " ) + drtype1
-                              + tr( " scans are processed." );
-         QMessageBox::warning( this,
-               tr( "Multiple Types with Missing Scans" ),
-               msg );
-      }
+                           +   "'" + drtype2 + "' .\n\n"
+                           + tr( "Choose one for initial display." );
+      QMessageBox mbox;
+      mbox.setWindowTitle( tr( "Scan Data Type to Process" ) );
+      mbox.setText( msg );
+      QPushButton* pb_opt1 = mbox.addButton( drtype1, QMessageBox::AcceptRole );
+      QPushButton* pb_opt2 = mbox.addButton( drtype2, QMessageBox::RejectRole );
+      mbox.setEscapeButton ( pb_opt2 );
+      mbox.setDefaultButton( pb_opt1 );
 
-      else
+      mbox.exec();
+      if ( mbox.clickedButton() == pb_opt2 )
       {
-         opsys << drtype1 << drtype2;
-         msg               += tr( "\nChoose one for initial display." );
-         QMessageBox mbox;
-         mbox.setWindowTitle( tr( "Scan Data Type to Process" ) );
-         mbox.setText( msg );
-         QPushButton* pb_opt1 = mbox.addButton( drtype1, QMessageBox::AcceptRole );
-         QPushButton* pb_opt2 = mbox.addButton( drtype2, QMessageBox::RejectRole );
-         mbox.setEscapeButton ( pb_opt2 );
-         mbox.setDefaultButton( pb_opt1 );
-
-         mbox.exec();
-         if ( mbox.clickedButton() == pb_opt2 )
-         {
-            runType            = runType2;
-            optndx             = 1;
-DbgLv(1) << "RDa:   runType2 scanmask" << runType2 << scanmask << "[ifw]scn_rows"
- << xpn_data->countOf( "iscn_rows" )
- << xpn_data->countOf( "fscn_rows" )
- << xpn_data->countOf( "wscn_rows" );
-         }
+         runType            = runType2;
+         optndx             = 1;
       }
    }
 
    qApp->processEvents();  //ALEXEY: maybe this will help
-DbgLv(1) << "RDa: 1. Crashes HERE!!!!";
+   
+   qDebug() << "1. Crashes HERE!!!!";
      
    cb_optsys->disconnect();
    cb_optsys->clear();
-DbgLv(1) << "RDa: 1a. Crashes HERE!!!!";
+
+   qDebug() << "1a. Crashes HERE!!!!";
    
    cb_optsys->addItems( opsys );                                  // ALEXEY fill out Optics listbox
-DbgLv(1) << "RDa: 1ab. Crashes HERE!!!! - BEFORE Setting index to cb_optsys";
+
+   qDebug() << "1ab. Crashes HERE!!!! - BEFORE Setting index to cb_optsys";
    cb_optsys->setCurrentIndex( optndx );
-DbgLv(1) << "RDa: 1ac. Crashes HERE!!!! - AFTER Setting index to cb_optsys";
+   qDebug() << "1ac. Crashes HERE!!!! - AFTER Setting index to cb_optsys";
    
    connect( cb_optsys,    SIGNAL( currentIndexChanged( int ) ),
             this,         SLOT  ( changeOptics( )            ) );
-DbgLv(1) << "RDa: 1b. Crashes HERE!!!!";
+
+   qDebug() << "1b. Crashes HERE!!!!";
    
    runID         = new_runID;
-DbgLv(1) << "RDa:  runID" << runID << "runType" << runType;
+DbgLv(1) << "RDr:  runID" << runID << "runType" << runType;
    xpn_data->set_run_values( runID, runType );                    // ALEXEY
-DbgLv(1) << "RDa: 2. Crashes HERE!!!! (after xpn_data->set_run_values( runID, runType ) )";
 
+   qDebug() << "2. Crashes HERE!!!! (after xpn_data->set_run_values( runID, runType ) )";
+
    // Build the AUC equivalent
    //QApplication::setOverrideCursor( QCursor( Qt::WaitCursor) );
    le_status->setText( tr( "Building AUC data ..." ) );
    qApp->processEvents();
 
    xpn_data->build_rawData( allData );                            // ALEXEY Builds Raw Data
-DbgLv(1) << "RDa: 3. Crashes HERE!!!! (after  xpn_data->build_rawData( allData ))";
+
+   qDebug() << "3. Crashes HERE!!!! (after  xpn_data->build_rawData( allData ))";
    
 double tm2=(double)sttime.msecsTo(QDateTime::currentDateTime())/1000.0;
-DbgLv(1) << "RDa:      build-raw done: tm1 tm2" << tm1 << tm2;
+DbgLv(1) << "RDr:      build-raw done: tm1 tm2" << tm1 << tm2;
 
    QApplication::restoreOverrideCursor();
    QApplication::restoreOverrideCursor();
@@ -2559,10 +2579,10 @@
    nscan         = allData[ 0 ].scanCount();
    npoint        = allData[ 0 ].pointCount();
 
-DbgLv(1) << "RDa: mwr ntriple" << ntriple;
-DbgLv(1) << "RDa: ncellch" << ncellch << cellchans.count();
-DbgLv(1) << "RDa: nscan" << nscan << "npoint" << npoint;
-DbgLv(1) << "RDa:   rvS rvE" << r_radii[0] << r_radii[npoint-1];
+DbgLv(1) << "RDr: mwr ntriple" << ntriple;
+DbgLv(1) << "RDr: ncellch" << ncellch << cellchans.count();
+DbgLv(1) << "RDr: nscan" << nscan << "npoint" << npoint;
+DbgLv(1) << "RDr:   rvS rvE" << r_radii[0] << r_radii[npoint-1];
    cb_cellchn->disconnect();                                      
    cb_cellchn->clear();
    cb_cellchn->addItems( cellchans );                             // ALEXEY fill out Cells/Channels listbox
@@ -2575,7 +2595,7 @@
 #if 0
    ntriple      = nlambda * ncellch;  // Number triples
    ntpoint      = npoint  * nscan;    // Number radius points per triple
-DbgLv(1) << "RDa: nwl wvlo wvhi" << nlambda << wvlo << wvhi
+DbgLv(1) << "RDr: nwl wvlo wvhi" << nlambda << wvlo << wvhi
    << "ncellch" << ncellch << "nlambda" << nlambda << "ntriple" << ntriple;
    triples.clear();
 
@@ -2589,18 +2609,18 @@
 #endif
 #if 1
    ntriple      = xpn_data->data_triples( triples );              // ALEXEY triples
-DbgLv(1) << "RDa: nwl wvlo wvhi" << nlambda << wvlo << wvhi
+DbgLv(1) << "RDr: nwl wvlo wvhi" << nlambda << wvlo << wvhi
    << "ncellch" << ncellch << "nlambda" << nlambda << "ntriple" << ntriple
    << triples.count();
 
- qDebug() << "RDa: nwl wvlo wvhi" << nlambda << wvlo << wvhi
+ qDebug() << "RDr: nwl wvlo wvhi" << nlambda << wvlo << wvhi
    << "ncellch" << ncellch << "nlambda" << nlambda << "ntriple" << ntriple
    << triples.count();
 #endif
 
-DbgLv(1) << "RDa: allData size" << allData.size();
+DbgLv(1) << "RDr: allData size" << allData.size();
 
- qDebug() << "RDa: allData size" << allData.size();
+ qDebug() << "RDr: allData size" << allData.size();
 
  //QApplication::restoreOverrideCursor();
    QString tspath = currentDir + "/" + runID + ".time_state.tmst";
@@ -2764,12 +2784,12 @@
    scanmask          += QString( sMasks ).mid( 6, 1 ) == "1" ? 8 : 0;
 DbgLv(1) << "RDr:     iRId" << iRunId << "sMsks scnmask" << sMasks << scanmask;
 
-   xpn_data->import_data( iRunId, scanmask );                             
-
+ xpn_data->import_data( iRunId, scanmask );                             
    int ntsrows        = xpn_data->countOf( "scan_rows" );
 DbgLv(1) << "RDr:     ntsrows" << ntsrows;
 DbgLv(1) << "RDr:      knt(triple)   " << xpn_data->countOf( "triple"    );
 
+
    if ( ntsrows < 1 )
    {
       le_status->setText( tr( "Run %1 has no associated data..." )
@@ -2788,7 +2808,7 @@
 
    if ( scanmask == 1  ||  scanmask == 2  ||
         scanmask == 4  ||  scanmask == 8 )
-   {  // Single type of data present
+   {
       runType            = ( scanmask == 2 ) ? "FI" : runType;
       runType            = ( scanmask == 4 ) ? "IP" : runType;
       runType            = ( scanmask == 8 ) ? "WI" : runType;
@@ -2803,7 +2823,7 @@
    }
 
    else if ( ( scanmask & 1 ) != 0 )
-   {  // Multiple data types present
+   {
       QApplication::restoreOverrideCursor();
       QApplication::restoreOverrideCursor();
       QString runType2( "IP" );
@@ -2817,46 +2837,25 @@
       drtype2            = ( runType2 == "RI" ) ? "Absorbance"   : drtype2;
       drtype2            = ( runType2 == "FI" ) ? "Fluorescence" : drtype2;
       drtype2            = ( runType2 == "WI" ) ? "Wavelength"   : drtype2;
+      opsys << drtype1 << drtype2;
+
       QString msg        = tr( "Multiple scan data types are present:\n" )
                            +   "'" + drtype1 + "'\n or \n"
-                           +   "'" + drtype2 + "' .\n";
-DbgLv(1) << "RDr:   runType2 scanmask" << runType2 << scanmask << "[ifw]scn_rows"
- << xpn_data->countOf( "iscn_rows" )
- << xpn_data->countOf( "fscn_rows" )
- << xpn_data->countOf( "wscn_rows" );
-      if ( ( runType2 == "IP"  &&  xpn_data->countOf( "iscn_rows" ) == 0 )  ||
-           ( runType2 == "FI"  &&  xpn_data->countOf( "fscn_rows" ) == 0 )  ||
-           ( runType2 == "WI"  &&  xpn_data->countOf( "wscn_rows" ) == 0 ) )
-      {
-         msg               += tr( "\nScans are missing so only " ) + drtype1
-                              + tr( " scans are processed." );
-         QMessageBox::warning( this,
-               tr( "Multiple Types with Missing Scans" ),
-               msg );
-      }
+                           +   "'" + drtype2 + "' .\n\n"
+                           + tr( "Choose one for initial display." );
+      QMessageBox mbox;
+      mbox.setWindowTitle( tr( "Scan Data Type to Process" ) );
+      mbox.setText( msg );
+      QPushButton* pb_opt1 = mbox.addButton( drtype1, QMessageBox::AcceptRole );
+      QPushButton* pb_opt2 = mbox.addButton( drtype2, QMessageBox::RejectRole );
+      mbox.setEscapeButton ( pb_opt2 );
+      mbox.setDefaultButton( pb_opt1 );
 
-      else
+      mbox.exec();
+      if ( mbox.clickedButton() == pb_opt2 )
       {
-         opsys << drtype1 << drtype2;
-         msg               += tr( "\nChoose one for initial display." );
-         QMessageBox mbox;
-         mbox.setWindowTitle( tr( "Scan Data Type to Process" ) );
-         mbox.setText( msg );
-         QPushButton* pb_opt1 = mbox.addButton( drtype1, QMessageBox::AcceptRole );
-         QPushButton* pb_opt2 = mbox.addButton( drtype2, QMessageBox::RejectRole );
-         mbox.setEscapeButton ( pb_opt2 );
-         mbox.setDefaultButton( pb_opt1 );
-
-         mbox.exec();
-         if ( mbox.clickedButton() == pb_opt2 )
-         {
-            runType            = runType2;
-            optndx             = 1;
-DbgLv(1) << "RDr:   runType2 scanmask" << runType2 << scanmask << "[ifw]scn_rows"
- << xpn_data->countOf( "iscn_rows" )
- << xpn_data->countOf( "fscn_rows" )
- << xpn_data->countOf( "wscn_rows" );
-         }
+         runType            = runType2;
+         optndx             = 1;
       }
    }
 

Modified: trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.h
===================================================================
--- trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.h	2019-09-22 14:56:01 UTC (rev 2833)
+++ trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.h	2019-09-25 07:35:36 UTC (rev 2834)
@@ -374,6 +374,7 @@
      void return_to_experiment( QString & );
      void close_program( void );
      void liveupdate_processes_stopped( void );
+     void aborted_back_to_initAutoflow( void );
 };
 #endif
 



More information about the us-commits mailing list