Skip to content

Commit

Permalink
we have a handle!
Browse files Browse the repository at this point in the history
Signed-off-by: vsoch <vsoch@users.noreply.github.com>
  • Loading branch information
vsoch committed Mar 27, 2023
1 parent 39cc2a0 commit 18f5d42
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 42 deletions.
4 changes: 2 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
##
# Prologue
##
AC_INIT([flux-core],
m4_esyscmd([test -n "$FLUX_VERSION" && printf $FLUX_VERSION || git describe --always | awk '/.*/ {sub(/^v/, ""); printf "%s",$1; exit}']))
AC_INIT([flux-core], 0.48.0)
# m4_esyscmd([test -n "$FLUX_VERSION" && printf $FLUX_VERSION || git describe --always | awk '/.*/ {sub(/^v/, ""); printf "%s",$1; exit}']))
AC_CONFIG_AUX_DIR([config])
AC_CONFIG_MACRO_DIR([config])
AC_CONFIG_SRCDIR([NEWS.md])
Expand Down
14 changes: 7 additions & 7 deletions src/bindings/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ POST_UNINSTALL = :
build_triplet = x86_64-pc-linux-gnu
host_triplet = x86_64-pc-linux-gnu
target_triplet = x86_64-pc-linux-gnu
am__append_1 = go
#am__append_1 = go
subdir = src/bindings
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/config/ac_pkgconfig.m4 \
Expand Down Expand Up @@ -215,9 +215,9 @@ AUTOCONF = ${SHELL} /workspaces/core/config/missing autoconf
AUTOHEADER = ${SHELL} /workspaces/core/config/missing autoheader
AUTOMAKE = ${SHELL} /workspaces/core/config/missing automake-1.16
AWK = mawk
AX_MAJOR_VERSION = 40b6737fb
AX_MINOR_VERSION = b
AX_POINT_VERSION =
AX_MAJOR_VERSION = 0
AX_MINOR_VERSION = 48
AX_POINT_VERSION = 0
CALIPER_CFLAGS =
CALIPER_LIBS =
CC = gcc
Expand Down Expand Up @@ -312,10 +312,10 @@ OTOOL64 =
PACKAGE = flux-core
PACKAGE_BUGREPORT =
PACKAGE_NAME = flux-core
PACKAGE_STRING = flux-core 40b6737fb
PACKAGE_STRING = flux-core 0.48.0
PACKAGE_TARNAME = flux-core
PACKAGE_URL =
PACKAGE_VERSION = 40b6737fb
PACKAGE_VERSION = 0.48.0
PATH_SEPARATOR = :
PKG_CONFIG = /usr/bin/pkg-config
PYLINT =
Expand All @@ -341,7 +341,7 @@ SSH = /usr/bin/rsh
STRIP = strip
VALGRIND_CFLAGS = -I/usr/include/valgrind
VALGRIND_LIBS = -L/usr/lib/x86_64-linux-gnu/valgrind -lcoregrind-amd64-linux -lvex-amd64-linux -lgcc
VERSION = 40b6737fb
VERSION = 0.48.0
WARNING_CFLAGS = -Wall -Werror -Wno-strict-aliasing -Wno-error=deprecated-declarations -Werror=missing-field-initializers
X_BINDIR = /usr/local/bin
X_DATADIR = /usr/local/share
Expand Down
23 changes: 11 additions & 12 deletions src/bindings/go/cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,23 @@ import (
"github.com/flux-framework/flux-core/pkg/core"
)


func main () {
func main() {
fmt.Println("⭐️ Testing flux-core in Go! ⭐️")

flux := core.NewFluxHandle()
fmt.Printf("This is a handle: %s\n\n", flux.Handle)

// from _flux._core import ffi, lib
// from _flux._core import ffi, lib

// policy := flag.String("policy", "", "Match policy")
// label := flag.String("label", "", "Label name for fluence dedicated nodes")
// label := flag.String("label", "", "Label name for fluence dedicated nodes")

// flag.Parse()
// flux := fluxion.Fluxion{}
// flux.InitFluxion(policy, label)
// flag.Parse()
// flux := fluxion.Fluxion{}
// flux.InitFluxion(policy, label)

// lis, err := net.Listen("tcp", port)
// if err != nil {
// fmt.Printf("[GRPCServer] failed to listen: %v\n", err)
// }
}
// lis, err := net.Listen("tcp", port)
// if err != nil {
// fmt.Printf("[GRPCServer] failed to listen: %v\n", err)
// }
}
2 changes: 1 addition & 1 deletion src/bindings/go/pkg/core/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ import "C"

func (f *FluxHandle) submit() {

}
}
40 changes: 21 additions & 19 deletions src/bindings/go/pkg/core/handle.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,33 +11,35 @@ package core
*/
import "C"
import (
"os"
"fmt"
"os"
)

// Create a new Flux Handle
func NewFluxHandle() FluxHandle {

// Get any FLUX_URI in the environment
flux_uri := os.Getenv("FLUX_URI")
uri := C.CString(flux_uri)
flags := C.int(0)
// Get any FLUX_URI in the environment
flux_uri := os.Getenv("FLUX_URI")
uri := C.CString(flux_uri)
flags := C.int(0)

// Create the handle
handle := C.flux_open(uri, flags)
// Create the handle
handle := C.flux_open(uri, flags)

// I don't know how to catch this if fails
if handle == nil {
var err C.flux_error_t
handle = C.flux_open_ex(uri, flags, &err)
}
// I don't know how to catch this if fails
if handle == nil {
var err C.flux_error_t
handle = C.flux_open_ex(uri, flags, &err)
}

// Note - the handle appears to still be nil
// $ ./fluxcore
// ⭐️ Testing flux-core in Go! ⭐️
// This is a handle: %!s(*core._Ctype_struct_flux_handle_struct=<nil>)
return FluxHandle{Handle: handle}
// if it's still nil, nogo
if handle == nil {
fmt.Println("Cannot create Flux handle. Is Flux running?")
os.Exit(1)
}
return FluxHandle{Handle: handle}
}

type FluxHandle struct {
Handle * C.flux_t
}
Handle *C.flux_t
}
1 change: 0 additions & 1 deletion src/bindings/go/pkg/flux/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,3 @@ const (
// Llperms as defined in sys/stat.h:196
Llperms = 0x5ff140
)

0 comments on commit 18f5d42

Please sign in to comment.