src/axl_async_bbapi.c
/* Called from AXL_Dispatch
 * Start the transfer, mark all files & set as INPROG
 * Assumes that mkdirs have already happened */
Called from AXL_Dispatch
Start the transfer, mark all files & set as INPROG
Assumes that mkdirs have already happened
Called from AXL_Dispatch Start the transfer mark all files & set as INPROG Assumes that mkdirs have already happened
int __axl_async_start_bbapi (int id, int resume) {
#ifdef HAVE_BBAPI
    int old_status;
    kvtree* file_list = axl_kvtrees[id];
    if (axl_bbapi_in_fallback(id)) {
        if (resume) {
            axl_pthread_resume(id);
        } else {
            axl_pthread_start(id);
        }
    }
    if (resume) {
        kvtree_util_get_int(file_list, AXL_KEY_STATUS, &old_status);
        if (old_status == AXL_STATUS_INPROG) {
            return AXL_SUCCESS;
        }
    }
    BBTransferHandle_t thandle;
    kvtree_util_get_unsigned_long(file_list, AXL_BBAPI_KEY_TRANSFERHANDLE, (unsigned long*) &thandle);
    BBTransferDef_t* tdef;
    kvtree_util_get_ptr(file_list, AXL_BBAPI_KEY_TRANSFERDEF, (void**) &tdef);
#if 0
    int file_count = kvtree_size(files);
    if (file_count == 0) {
        kvtree_util_set_int(file_list, AXL_KEY_STATUS, AXL_STATUS_DEST);
        return AXL_SUCCESS;
    }
#endif
    int rc = BB_StartTransfer(tdef, thandle);
    if (bb_check(rc) != AXL_SUCCESS) {
        kvtree_util_set_int(file_list, AXL_KEY_STATUS, AXL_STATUS_ERROR);
        rc = AXL_FAILURE;
        goto end;
    }
    kvtree_util_set_int(file_list, AXL_KEY_STATUS, AXL_STATUS_INPROG);
    kvtree_elem* elem;
    kvtree* files = kvtree_get(file_list, AXL_KEY_FILES);
    for (elem = kvtree_elem_first(files);
         elem != NULL;
         elem = kvtree_elem_next(elem))
    {
        kvtree* elem_hash = kvtree_elem_hash(elem);
        kvtree_util_set_int(elem_hash, AXL_KEY_FILE_STATUS, AXL_STATUS_INPROG);
    }
    rc = BB_FreeTransferDef(tdef);
    bb_check(rc);
    kvtree_unset(file_list, AXL_BBAPI_KEY_TRANSFERDEF);
    rc = AXL_SUCCESS;
end:
    axl_write_state_file(id);
    return rc;
#endif
    return AXL_FAILURE;
}
int __axl_async_start_bbapi ( int id , int resume ) { #ifdef HAVE_BBAPI int old_status ; kvtree * file_list = axl_kvtrees [ id ] ; if ( axl_bbapi_in_fallback ( id ) ) { if ( resume ) { axl_pthread_resume ( id ) ; } else { axl_pthread_start ( id ) ; } } if ( resume ) { kvtree_util_get_int ( file_list , AXL_KEY_STATUS , & old_status ) ; if ( old_status == AXL_STATUS_INPROG ) { return AXL_SUCCESS ; } } BBTransferHandle_t thandle ; kvtree_util_get_unsigned_long ( file_list , AXL_BBAPI_KEY_TRANSFERHANDLE , ( unsigned long * ) & thandle ) ; BBTransferDef_t * tdef ; kvtree_util_get_ptr ( file_list , AXL_BBAPI_KEY_TRANSFERDEF , ( void * * ) & tdef ) ; #if 0 int file_count = kvtree_size ( files ) ; if ( file_count == 0 ) { kvtree_util_set_int ( file_list , AXL_KEY_STATUS , AXL_STATUS_DEST ) ; return AXL_SUCCESS ; } #endif int rc = BB_StartTransfer ( tdef , thandle ) ; if ( bb_check ( rc ) != AXL_SUCCESS ) { kvtree_util_set_int ( file_list , AXL_KEY_STATUS , AXL_STATUS_ERROR ) ; rc = AXL_FAILURE ; goto end ; } kvtree_util_set_int ( file_list , AXL_KEY_STATUS , AXL_STATUS_INPROG ) ; kvtree_elem * elem ; kvtree * files = kvtree_get ( file_list , AXL_KEY_FILES ) ; for ( elem = kvtree_elem_first ( files ) ; elem != NULL ; elem = kvtree_elem_next ( elem ) ) { kvtree * elem_hash = kvtree_elem_hash ( elem ) ; kvtree_util_set_int ( elem_hash , AXL_KEY_FILE_STATUS , AXL_STATUS_INPROG ) ; } rc = BB_FreeTransferDef ( tdef ) ; bb_check ( rc ) ; kvtree_unset ( file_list , AXL_BBAPI_KEY_TRANSFERDEF ) ; rc = AXL_SUCCESS ; end : axl_write_state_file ( id ) ; return rc ; #endif return AXL_FAILURE ; }
Called from AXL_Dispatch
 Start the transfer, mark all files & set as INPROG
 Assumes that mkdirs have already happened
Called from AXL_Dispatch Start the transfer mark all files & set as INPROG Assumes that mkdirs have already happened
/* We're in fallback mode because some of the paths we want to
         * transfer from/to are not compatible with the BBAPI transfers (like
         * if the underlying filesystem doesn't support extent). */ /* Our transfers are already going.  Nothing to do */ /* Pull BB-Def and BB-Handle out of global var */ /* TODO: is this necessary? */ /* If there are 0 files, mark this as a success */ /* Launch the transfer.  Note, while BB_StartTransfer() does launch an
     * asynchronous transfer, that doesn't mean it returns immediately.  For
     * example, when launched as a job, it can take the following amount of time
     * for the function to return:
     *
     * Amount   Startup time
     * ------   ------------
     * 1GB      1 sec
     * 10GB     5 sec
     * 20GB     10 sec
     * 100GB+   17 sec
     *
     * And for whatever reason, BB_StartTransfer() returns almost immediately
     * on interactive nodes.  A 20GB BB_StartTransfer() returns instantly, while
     * 100GB+ returns in 1-2 sec. */ /* something went wrong, update transfer to error state */ /* mark this transfer as in progress */ /* Mark all files as INPROG */ /* free the transfer definition */ /* drop transfer definition from kvtree */