Changeset 2834


Ignore:
Timestamp:
Sep 25, 2019 7:35:36 AM (3 months ago)
Author:
alexey
Message:

autoflow: updates for proper handling job reattachement, jumping back and forth to Manage Optima Runs, and premature job abortion when no data yet generated....

Location:
trunk/programs
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/programs/us_com_project/us_com_project_gui.cpp

    r2825 r2834  
    176176   connect( epanObserv, SIGNAL( close_everything() ), this, SLOT( close_all() ));
    177177   connect( this, SIGNAL( reset_live_update() ),  epanObserv, SLOT( reset_live_update( )  ) );
     178   connect( epanObserv, SIGNAL( processes_stopped() ), this, SLOT( liveupdate_stopped() ));
     179   connect( epanObserv, SIGNAL( stop_nodata() ), this, SLOT( close_all() ));
    178180   
    179181   //connect( epanPostProd, SIGNAL( switch_to_analysis( QString &, QString &) ),  this, SLOT( switch_to_analysis( QString &, QString & )  ) );
     
    344346   connect( this, SIGNAL( reset_live_update() ),  epanObserv, SLOT( reset_live_update( )  ) );
    345347   connect( epanObserv, SIGNAL( processes_stopped() ), this, SLOT( liveupdate_stopped() ));
     348   connect( epanObserv, SIGNAL( stop_nodata() ), this, SLOT( close_all() ));
    346349   
    347350   connect( epanPostProd, SIGNAL( switch_to_editing( QString &, QString &) ),  this, SLOT( switch_to_editing( QString &, QString & )  ) );
     
    17311734
    17321735   connect( sdiag, SIGNAL( liveupdate_processes_stopped() ), this, SLOT( processes_stopped_passed()  ) );
     1736
     1737   //ALEXEY: premature abortion with no data
     1738   connect( sdiag, SIGNAL( aborted_back_to_initAutoflow( ) ), this, SLOT( to_initAutoflow_xpnviewer ( ) ) );
    17331739   
    17341740   offset = 0;
     
    17721778}
    17731779
     1780void US_ObservGui::to_initAutoflow_xpnviewer ( void )
     1781{
     1782  emit stop_nodata();
     1783}
     1784
    17741785void US_ObservGui::processes_stopped_passed( void )
    17751786{
  • trunk/programs/us_com_project/us_com_project_gui.h

    r2825 r2834  
    190190      void to_close_program( void );
    191191      void reset_live_update( void );
    192       void processes_stopped_passed( void );
     192      void processes_stopped_passed( void );
     193      void to_initAutoflow_xpnviewer ( void );
    193194 signals:
    194195      void to_xpn_viewer( QMap < QString, QString > & protocol_details );
     
    197198      void close_everything( void );
    198199      void reset_live_update_passed( void );
    199       void processes_stopped( void );
     200      void processes_stopped( void );
     201      void stop_nodata( void );
    200202};
    201203
  • trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.cpp

    r2833 r2834  
    15981598
    15991599      //ALEXEY: make sure ExpID is coupled to the RunID which is already in the autoflow DB
    1600       if ( !runID_passed.isEmpty() || runID_passed != "NULL" )
    1601   {
    1602     if ( runID_passed.toInt() != RunID_to_retrieve.toInt() )
    1603       {
    1604         RunID_to_retrieve = runID_passed;
    1605         qDebug() << "Correcting RunID to : " << RunID_to_retrieve;
    1606       }
    1607   }
     1600      if ( runID_passed != "NULL" )
     1601        {
     1602          if ( runID_passed.toInt() != RunID_to_retrieve.toInt() )
     1603            {
     1604              RunID_to_retrieve = runID_passed;
     1605              qDebug() << "Correcting RunID to : " << RunID_to_retrieve;
     1606            }
     1607        }
    16081608 
    16091609     
     
    23442344//    if ( lddiag->exec() == QDialog::Rejected )                    //ALEXEY need drDesc but do NOT need dialog
    23452345//    {
    2346 // DbgLv(1) << "RDa:  rtn fr XpnRunRaw dialog: CANCEL";
     2346// DbgLv(1) << "RDr:  rtn fr XpnRunRaw dialog: CANCEL";
    23472347//       return;
    23482348//    }
     
    23502350//    // Restore area beneath dialog
    23512351//    qApp->processEvents();
    2352 // DbgLv(1) << "RDa:  rtn fr XpnRunRaw dialog";
    2353 // DbgLv(1) << "RDa:   drDesc" << drDesc;
     2352// DbgLv(1) << "RDr:  rtn fr XpnRunRaw dialog";
     2353// DbgLv(1) << "RDr:   drDesc" << drDesc;
    23542354
    23552355   // See if we need to fix the runID
     
    24122412   scanmask          += QString( sMasks ).mid( 4, 1 ) == "1" ? 4 : 0;
    24132413   scanmask          += QString( sMasks ).mid( 6, 1 ) == "1" ? 8 : 0;
    2414 DbgLv(1) << "RDa:     iRId" << iRunId << "sMsks scnmask" << sMasks << scanmask;
     2414DbgLv(1) << "RDr:     iRId" << iRunId << "sMsks scnmask" << sMasks << scanmask;
     2415
     2416 qDebug() << "RDr:     iRId" << iRunId << "sMsks scnmask" << sMasks << scanmask;
    24152417
    24162418 //ALEXEY: maybe put in_reload_check_sysdata = true; and then false (after xpn_data->import_data( iRunId, scanmask ); )
    24172419 //in_reload_check_sysdata = true; //ALEXEY
    2418 
    2419    xpn_data->import_data( iRunId, scanmask );                               // ALEXEY <-- actual data retreiving
    2420 
     2420 xpn_data->import_data( iRunId, scanmask );                               // ALEXEY <-- actual data retreiving
    24212421   int ntsrows        = xpn_data->countOf( "scan_rows" );
    2422 DbgLv(1) << "RDa:     ntsrows" << ntsrows;
    2423 DbgLv(1) << "RDa:      knt(triple)   " << xpn_data->countOf( "triple"    );
     2422DbgLv(1) << "RDr:     ntsrows" << ntsrows;
     2423DbgLv(1) << "RDr:      knt(triple)   " << xpn_data->countOf( "triple"    );
    24242424 qApp->processEvents();
    24252425
     
    24302430
    24312431      in_reload_all_data   = false; 
     2432     
     2433      //ALEXEY: rare case when no data but exp. aborted !!!!
     2434      if ( CheckExpComplete_auto( RunID_to_retrieve ) == 0 ) //ALEXEY should be == 3 as per documentation
     2435  {
     2436    if ( finishing_live_update )
     2437      {
     2438        timer_all_data_avail->stop();
     2439        disconnect(timer_all_data_avail, SIGNAL(timeout()), 0, 0);   //Disconnect timer from anything
     2440        in_reload_all_data   = false; 
     2441        return;
     2442      }
     2443   
     2444    qDebug() << "ABORTION IN EARLY STAGE...";
     2445   
     2446    experimentAborted  = true;
     2447   
     2448    timer_all_data_avail->stop();
     2449    disconnect(timer_all_data_avail, SIGNAL(timeout()), 0, 0);   //Disconnect timer from anything
     2450   
     2451    if ( !timer_check_sysdata->isActive()  ) // Check if sys_data Timer is stopped
     2452      {
     2453        //message on aborted run with no data
     2454        QMessageBox::warning( this,
     2455            tr( "Run Was Aborted" ),
     2456            tr( "No data were produced. The current run will be erased. The program will return to the list of Optima runs..." ));
     2457       
     2458        delete_autoflow_record();
     2459        reset_auto();
     2460       
     2461        in_reload_all_data   = false; 
     2462        emit aborted_back_to_initAutoflow( );
     2463        return;
     2464      }
     2465  }
     2466     
    24322467      return;
    24332468   }
     
    24752510      drtype2            = ( runType2 == "FI" ) ? "Fluorescence" : drtype2;
    24762511      drtype2            = ( runType2 == "WI" ) ? "Wavelength"   : drtype2;
     2512      opsys << drtype1 << drtype2;
     2513
    24772514      QString msg        = tr( "Multiple scan data types are present:\n" )
    24782515                           +   "'" + drtype1 + "'\n or \n"
    2479                            +   "'" + drtype2 + "' .\n";
    2480 DbgLv(1) << "RDa:   runType2 scanmask" << runType2 << scanmask << "[ifw]scn_rows"
    2481  << xpn_data->countOf( "iscn_rows" )
    2482  << xpn_data->countOf( "fscn_rows" )
    2483  << xpn_data->countOf( "wscn_rows" );
    2484       if ( ( runType2 == "IP"  &&  xpn_data->countOf( "iscn_rows" ) == 0 )  ||
    2485            ( runType2 == "FI"  &&  xpn_data->countOf( "fscn_rows" ) == 0 )  ||
    2486            ( runType2 == "WI"  &&  xpn_data->countOf( "wscn_rows" ) == 0 ) )
     2516                           +   "'" + drtype2 + "' .\n\n"
     2517                           + tr( "Choose one for initial display." );
     2518      QMessageBox mbox;
     2519      mbox.setWindowTitle( tr( "Scan Data Type to Process" ) );
     2520      mbox.setText( msg );
     2521      QPushButton* pb_opt1 = mbox.addButton( drtype1, QMessageBox::AcceptRole );
     2522      QPushButton* pb_opt2 = mbox.addButton( drtype2, QMessageBox::RejectRole );
     2523      mbox.setEscapeButton ( pb_opt2 );
     2524      mbox.setDefaultButton( pb_opt1 );
     2525
     2526      mbox.exec();
     2527      if ( mbox.clickedButton() == pb_opt2 )
    24872528      {
    2488          msg               += tr( "\nScans are missing so only " ) + drtype1
    2489                               + tr( " scans are processed." );
    2490          QMessageBox::warning( this,
    2491                tr( "Multiple Types with Missing Scans" ),
    2492                msg );
     2529         runType            = runType2;
     2530         optndx             = 1;
    24932531      }
    2494 
    2495       else
    2496       {
    2497          opsys << drtype1 << drtype2;
    2498          msg               += tr( "\nChoose one for initial display." );
    2499          QMessageBox mbox;
    2500          mbox.setWindowTitle( tr( "Scan Data Type to Process" ) );
    2501          mbox.setText( msg );
    2502          QPushButton* pb_opt1 = mbox.addButton( drtype1, QMessageBox::AcceptRole );
    2503          QPushButton* pb_opt2 = mbox.addButton( drtype2, QMessageBox::RejectRole );
    2504          mbox.setEscapeButton ( pb_opt2 );
    2505          mbox.setDefaultButton( pb_opt1 );
    2506 
    2507          mbox.exec();
    2508          if ( mbox.clickedButton() == pb_opt2 )
    2509          {
    2510             runType            = runType2;
    2511             optndx             = 1;
    2512 DbgLv(1) << "RDa:   runType2 scanmask" << runType2 << scanmask << "[ifw]scn_rows"
    2513  << xpn_data->countOf( "iscn_rows" )
    2514  << xpn_data->countOf( "fscn_rows" )
    2515  << xpn_data->countOf( "wscn_rows" );
    2516          }
    2517       }
    25182532   }
    25192533
    25202534   qApp->processEvents();  //ALEXEY: maybe this will help
    2521 DbgLv(1) << "RDa: 1. Crashes HERE!!!!";
     2535   
     2536   qDebug() << "1. Crashes HERE!!!!";
    25222537     
    25232538   cb_optsys->disconnect();
    25242539   cb_optsys->clear();
    2525 DbgLv(1) << "RDa: 1a. Crashes HERE!!!!";
     2540
     2541   qDebug() << "1a. Crashes HERE!!!!";
    25262542   
    25272543   cb_optsys->addItems( opsys );                                  // ALEXEY fill out Optics listbox
    2528 DbgLv(1) << "RDa: 1ab. Crashes HERE!!!! - BEFORE Setting index to cb_optsys";
     2544
     2545   qDebug() << "1ab. Crashes HERE!!!! - BEFORE Setting index to cb_optsys";
    25292546   cb_optsys->setCurrentIndex( optndx );
    2530 DbgLv(1) << "RDa: 1ac. Crashes HERE!!!! - AFTER Setting index to cb_optsys";
     2547   qDebug() << "1ac. Crashes HERE!!!! - AFTER Setting index to cb_optsys";
    25312548   
    25322549   connect( cb_optsys,    SIGNAL( currentIndexChanged( int ) ),
    25332550            this,         SLOT  ( changeOptics( )            ) );
    2534 DbgLv(1) << "RDa: 1b. Crashes HERE!!!!";
     2551
     2552   qDebug() << "1b. Crashes HERE!!!!";
    25352553   
    25362554   runID         = new_runID;
    2537 DbgLv(1) << "RDa:  runID" << runID << "runType" << runType;
     2555DbgLv(1) << "RDr:  runID" << runID << "runType" << runType;
    25382556   xpn_data->set_run_values( runID, runType );                    // ALEXEY
    2539 DbgLv(1) << "RDa: 2. Crashes HERE!!!! (after xpn_data->set_run_values( runID, runType ) )";
     2557
     2558   qDebug() << "2. Crashes HERE!!!! (after xpn_data->set_run_values( runID, runType ) )";
    25402559
    25412560   // Build the AUC equivalent
     
    25452564
    25462565   xpn_data->build_rawData( allData );                            // ALEXEY Builds Raw Data
    2547 DbgLv(1) << "RDa: 3. Crashes HERE!!!! (after  xpn_data->build_rawData( allData ))";
     2566
     2567   qDebug() << "3. Crashes HERE!!!! (after  xpn_data->build_rawData( allData ))";
    25482568   
    25492569double tm2=(double)sttime.msecsTo(QDateTime::currentDateTime())/1000.0;
    2550 DbgLv(1) << "RDa:      build-raw done: tm1 tm2" << tm1 << tm2;
     2570DbgLv(1) << "RDr:      build-raw done: tm1 tm2" << tm1 << tm2;
    25512571
    25522572   QApplication::restoreOverrideCursor();
     
    25602580   npoint        = allData[ 0 ].pointCount();
    25612581
    2562 DbgLv(1) << "RDa: mwr ntriple" << ntriple;
    2563 DbgLv(1) << "RDa: ncellch" << ncellch << cellchans.count();
    2564 DbgLv(1) << "RDa: nscan" << nscan << "npoint" << npoint;
    2565 DbgLv(1) << "RDa:   rvS rvE" << r_radii[0] << r_radii[npoint-1];
     2582DbgLv(1) << "RDr: mwr ntriple" << ntriple;
     2583DbgLv(1) << "RDr: ncellch" << ncellch << cellchans.count();
     2584DbgLv(1) << "RDr: nscan" << nscan << "npoint" << npoint;
     2585DbgLv(1) << "RDr:   rvS rvE" << r_radii[0] << r_radii[npoint-1];
    25662586   cb_cellchn->disconnect();                                     
    25672587   cb_cellchn->clear();
     
    25762596   ntriple      = nlambda * ncellch;  // Number triples
    25772597   ntpoint      = npoint  * nscan;    // Number radius points per triple
    2578 DbgLv(1) << "RDa: nwl wvlo wvhi" << nlambda << wvlo << wvhi
     2598DbgLv(1) << "RDr: nwl wvlo wvhi" << nlambda << wvlo << wvhi
    25792599   << "ncellch" << ncellch << "nlambda" << nlambda << "ntriple" << ntriple;
    25802600   triples.clear();
     
    25902610#if 1
    25912611   ntriple      = xpn_data->data_triples( triples );              // ALEXEY triples
    2592 DbgLv(1) << "RDa: nwl wvlo wvhi" << nlambda << wvlo << wvhi
     2612DbgLv(1) << "RDr: nwl wvlo wvhi" << nlambda << wvlo << wvhi
    25932613   << "ncellch" << ncellch << "nlambda" << nlambda << "ntriple" << ntriple
    25942614   << triples.count();
    25952615
    2596  qDebug() << "RDa: nwl wvlo wvhi" << nlambda << wvlo << wvhi
     2616 qDebug() << "RDr: nwl wvlo wvhi" << nlambda << wvlo << wvhi
    25972617   << "ncellch" << ncellch << "nlambda" << nlambda << "ntriple" << ntriple
    25982618   << triples.count();
    25992619#endif
    26002620
    2601 DbgLv(1) << "RDa: allData size" << allData.size();
    2602 
    2603  qDebug() << "RDa: allData size" << allData.size();
     2621DbgLv(1) << "RDr: allData size" << allData.size();
     2622
     2623 qDebug() << "RDr: allData size" << allData.size();
    26042624
    26052625 //QApplication::restoreOverrideCursor();
     
    27652785DbgLv(1) << "RDr:     iRId" << iRunId << "sMsks scnmask" << sMasks << scanmask;
    27662786
    2767    xpn_data->import_data( iRunId, scanmask );                             
    2768 
     2787 xpn_data->import_data( iRunId, scanmask );                             
    27692788   int ntsrows        = xpn_data->countOf( "scan_rows" );
    27702789DbgLv(1) << "RDr:     ntsrows" << ntsrows;
    27712790DbgLv(1) << "RDr:      knt(triple)   " << xpn_data->countOf( "triple"    );
     2791
    27722792
    27732793   if ( ntsrows < 1 )
     
    27892809   if ( scanmask == 1  ||  scanmask == 2  ||
    27902810        scanmask == 4  ||  scanmask == 8 )
    2791    {  // Single type of data present
     2811   {
    27922812      runType            = ( scanmask == 2 ) ? "FI" : runType;
    27932813      runType            = ( scanmask == 4 ) ? "IP" : runType;
     
    28042824
    28052825   else if ( ( scanmask & 1 ) != 0 )
    2806    {  // Multiple data types present
     2826   {
    28072827      QApplication::restoreOverrideCursor();
    28082828      QApplication::restoreOverrideCursor();
     
    28182838      drtype2            = ( runType2 == "FI" ) ? "Fluorescence" : drtype2;
    28192839      drtype2            = ( runType2 == "WI" ) ? "Wavelength"   : drtype2;
     2840      opsys << drtype1 << drtype2;
     2841
    28202842      QString msg        = tr( "Multiple scan data types are present:\n" )
    28212843                           +   "'" + drtype1 + "'\n or \n"
    2822                            +   "'" + drtype2 + "' .\n";
    2823 DbgLv(1) << "RDr:   runType2 scanmask" << runType2 << scanmask << "[ifw]scn_rows"
    2824  << xpn_data->countOf( "iscn_rows" )
    2825  << xpn_data->countOf( "fscn_rows" )
    2826  << xpn_data->countOf( "wscn_rows" );
    2827       if ( ( runType2 == "IP"  &&  xpn_data->countOf( "iscn_rows" ) == 0 )  ||
    2828            ( runType2 == "FI"  &&  xpn_data->countOf( "fscn_rows" ) == 0 )  ||
    2829            ( runType2 == "WI"  &&  xpn_data->countOf( "wscn_rows" ) == 0 ) )
     2844                           +   "'" + drtype2 + "' .\n\n"
     2845                           + tr( "Choose one for initial display." );
     2846      QMessageBox mbox;
     2847      mbox.setWindowTitle( tr( "Scan Data Type to Process" ) );
     2848      mbox.setText( msg );
     2849      QPushButton* pb_opt1 = mbox.addButton( drtype1, QMessageBox::AcceptRole );
     2850      QPushButton* pb_opt2 = mbox.addButton( drtype2, QMessageBox::RejectRole );
     2851      mbox.setEscapeButton ( pb_opt2 );
     2852      mbox.setDefaultButton( pb_opt1 );
     2853
     2854      mbox.exec();
     2855      if ( mbox.clickedButton() == pb_opt2 )
    28302856      {
    2831          msg               += tr( "\nScans are missing so only " ) + drtype1
    2832                               + tr( " scans are processed." );
    2833          QMessageBox::warning( this,
    2834                tr( "Multiple Types with Missing Scans" ),
    2835                msg );
    2836       }
    2837 
    2838       else
    2839       {
    2840          opsys << drtype1 << drtype2;
    2841          msg               += tr( "\nChoose one for initial display." );
    2842          QMessageBox mbox;
    2843          mbox.setWindowTitle( tr( "Scan Data Type to Process" ) );
    2844          mbox.setText( msg );
    2845          QPushButton* pb_opt1 = mbox.addButton( drtype1, QMessageBox::AcceptRole );
    2846          QPushButton* pb_opt2 = mbox.addButton( drtype2, QMessageBox::RejectRole );
    2847          mbox.setEscapeButton ( pb_opt2 );
    2848          mbox.setDefaultButton( pb_opt1 );
    2849 
    2850          mbox.exec();
    2851          if ( mbox.clickedButton() == pb_opt2 )
    2852          {
    2853             runType            = runType2;
    2854             optndx             = 1;
    2855 DbgLv(1) << "RDr:   runType2 scanmask" << runType2 << scanmask << "[ifw]scn_rows"
    2856  << xpn_data->countOf( "iscn_rows" )
    2857  << xpn_data->countOf( "fscn_rows" )
    2858  << xpn_data->countOf( "wscn_rows" );
    2859          }
     2857         runType            = runType2;
     2858         optndx             = 1;
    28602859      }
    28612860   }
  • trunk/programs/us_xpn_viewer/us_xpn_viewer_gui.h

    r2825 r2834  
    375375     void close_program( void );
    376376     void liveupdate_processes_stopped( void );
     377     void aborted_back_to_initAutoflow( void );
    377378};
    378379#endif
Note: See TracChangeset for help on using the changeset viewer.