Commit ea6017d1 authored by Alberto Miranda's avatar Alberto Miranda ♨️
Browse files

Merge branch '25-add-nornsctl_-functions-for-tasks' into 'master'

Resolve "Add nornsctl_* functions for tasks"

Closes #25

See merge request !10
parents cab2a1e1 877c279f
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -16,3 +16,4 @@ config.log
src/old-sources
src/old-sources
src/spdlog_0.12/
src/spdlog_0.12/
build
build
build.*
+2 −2
Original line number Original line Diff line number Diff line
@@ -209,9 +209,9 @@ test:coverage:
        - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./core -as
        - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./core -as
        - make -j$(nproc) api
        - make -j$(nproc) api
        - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::NORNS_TASK]"
        - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::NORNS_TASK]"
        - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::norns_error]"
        - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::norns_iotask_init]"
        - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::norns_iotask_init]"
        - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::norns_resource_init]"
        - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::norns_resource_init]"
        - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::norns_status]"
        - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::norns_submit]"
        - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::norns_submit]"
        - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::norns_submit_copy_buffer_to_file]"
        - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::norns_submit_copy_buffer_to_file]"
        - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::norns_submit_copy_local_posix_files]"
        - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::norns_submit_copy_local_posix_files]"
@@ -325,9 +325,9 @@ test:optimized:
        - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./core -as
        - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./core -as
        - make -j$(nproc) api
        - make -j$(nproc) api
        - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::NORNS_TASK]"
        - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::NORNS_TASK]"
        - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::norns_error]"
        - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::norns_iotask_init]"
        - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::norns_iotask_init]"
        - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::norns_resource_init]"
        - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::norns_resource_init]"
        - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::norns_status]"
        - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::norns_submit]"
        - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::norns_submit]"
        - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::norns_submit_copy_buffer_to_file]"
        - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::norns_submit_copy_buffer_to_file]"
        - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::norns_submit_copy_local_posix_files]"
        - NORNS_DEBUG_CONFIG_FILE_OVERRIDE=1 ./api -as "[api::norns_submit_copy_local_posix_files]"
+0 −2
Original line number Original line Diff line number Diff line
@@ -32,10 +32,8 @@ nornsincludedir=$(includedir)/norns
nornsinclude_HEADERS = \
nornsinclude_HEADERS = \
	norns/norns.h \
	norns/norns.h \
	norns/nornsctl.h \
	norns/nornsctl.h \
	norns/norns_backends.h \
	norns/norns_debug.h \
	norns/norns_debug.h \
	norns/norns_error.h \
	norns/norns_error.h \
	norns/norns_resources.h \
	norns/norns_types.h
	norns/norns_types.h


include_HEADERS = \
include_HEADERS = \
+16 −32
Original line number Original line Diff line number Diff line
@@ -38,8 +38,6 @@


#include "norns_types.h"
#include "norns_types.h"
#include "norns_error.h"
#include "norns_error.h"
#include "norns_backends.h"
#include "norns_resources.h"


#ifdef __NORNS_DEBUG__
#ifdef __NORNS_DEBUG__
#include "norns_debug.h"
#include "norns_debug.h"
@@ -49,51 +47,37 @@
extern "C" {
extern "C" {
#endif
#endif



/* Descriptor for an I/O task */
typedef struct {
    norns_tid_t         t_id;   /* task identifier */
    norns_op_t          t_op;   /* operation to be performed */
    norns_resource_t    t_src;  /* source resource */
    norns_resource_t    t_dst;  /* destination resource */
} norns_iotask_t;

/* Task types */
#define NORNS_IOTASK_COPY   0x1
#define NORNS_IOTASK_MOVE   0x2
#define NORNS_IOTASK_REMOVE 0x3

/* I/O task status descriptor */
typedef struct {
    norns_status_t st_status;     /* task current status */
    norns_error_t  st_task_error; /* task return value */
    int            st_sys_errno;  /* errno returned if st_task_error == NORNS_ESYSTEM_ERROR */
    size_t         st_pending;    /* bytes pending in task */
    size_t         st_total;      /* total bytes in task */
} norns_stat_t;

/**************************************************************************/
/**************************************************************************/
/* Client API                                                             */
/* Client API                                                             */
/**************************************************************************/
/**************************************************************************/


/* Initialize an asynchronous I/O task */
/* Initialize an asynchronous I/O task */
void norns_iotask_init(norns_iotask_t* task, norns_op_t operation,
void 
                       norns_resource_t* src, norns_resource_t* dst) __THROW;
norns_iotask_init(norns_iotask_t* task, 
                  norns_op_t operation,
                  norns_resource_t* src, 
                  norns_resource_t* dst) __THROW;


norns_iotask_t 
norns_iotask_t 
NORNS_IOTASK(norns_op_t operation, norns_resource_t src, ...) __THROW;
NORNS_IOTASK(norns_op_t operation, 
             norns_resource_t src, ...) __THROW;


/* Submit an asynchronous I/O task */
/* Submit an asynchronous I/O task */
norns_error_t norns_submit(norns_iotask_t* task) __THROW;
norns_error_t 
norns_submit(norns_iotask_t* task) __THROW;


/* wait for the completion of the I/O task associated to 'task' */
/* wait for the completion of the I/O task associated to 'task' */
norns_error_t norns_wait(norns_iotask_t* task) __THROW;
norns_error_t 
norns_wait(norns_iotask_t* task) __THROW;


/* Try to cancel an asynchronous I/O task associated with task */
/* Try to cancel an asynchronous I/O task associated with task */
norns_error_t norns_cancel(norns_iotask_t* task) __THROW;
norns_error_t 
norns_cancel(norns_iotask_t* task) __THROW;


/* Check the status of a submitted I/O task */
/* Check the status of a submitted I/O task */
norns_error_t norns_status(norns_iotask_t* task, norns_stat_t* stats) __THROW;
norns_error_t 
norns_error(norns_iotask_t* task, 
            norns_stat_t* stats) __THROW;


/* Return a string describing the error number */
/* Return a string describing the error number */
char* norns_strerror(norns_error_t errnum) __THROW;
char* norns_strerror(norns_error_t errnum) __THROW;

include/norns/norns_backends.h

deleted100644 → 0
+0 −48
Original line number Original line Diff line number Diff line
/*************************************************************************
 * Copyright (C) 2017-2018 Barcelona Supercomputing Center               *
 *                         Centro Nacional de Supercomputacion           *
 * All rights reserved.                                                  *
 *                                                                       *
 * This file is part of the NORNS Data Scheduler, a service that allows  *
 * other programs to start, track and manage asynchronous transfers of   *
 * data resources transfers requests between different storage backends. *
 *                                                                       *
 * See AUTHORS file in the top level directory for information           *
 * regarding developers and contributors.                                *
 *                                                                       *
 * The NORNS Data Scheduler is free software: you can redistribute it    *
 * and/or modify it under the terms of the GNU Lesser General Public     *
 * License as published by the Free Software Foundation, either          *
 * version 3 of the License, or (at your option) any later version.      *
 *                                                                       *
 * The NORNS Data Scheduler is distributed in the hope that it will be   *
 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty   *
 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU  *
 * Lesser General Public License for more details.                       *
 *                                                                       *
 * You should have received a copy of the GNU Lesser General             *
 * Public License along with the NORNS Data Scheduler.  If not, see      *
 * <http://www.gnu.org/licenses/>.                                       *
 *************************************************************************/

#ifndef __NORNS_BACKENDS_H__
#define __NORNS_BACKENDS_H__

#ifdef __cplusplus
extern "C" {
#endif

/* Storage backend types */
//#define NORNS_BACKEND_LOCAL_NVML        0x10000000
//#define NORNS_BACKEND_REMOTE_NVML       0x10000001
//#define NORNS_BACKEND_PROCESS_MEMORY    0x10000005 // deprecated
#define NORNS_BACKEND_NVML              0x10000001
#define NORNS_BACKEND_LUSTRE            0x10000002
#define NORNS_BACKEND_ECHOFS            0x10000003
#define NORNS_BACKEND_POSIX_FILESYSTEM  0x10000004

#ifdef __cplusplus
}
#endif

#endif /* __NORNS_BACKENDS_H__ */
Loading