MonetDB: Jul2017 - Initialize sys.argv, because tensorflow requi...

Panagiotis Koutsourakis kutsurak at monetdbsolutions.com
Fri Jun 16 12:44:51 CEST 2017


Hello developers,

Taking the opportunity from this commit, I wanted to initiate a
discussion with respect the executable names inside the code. A few
weeks ago I faced a problem when using the configure options
--program-prefix and --program-suffix, that change the executable names.
The problem was that the name mserver5 was hard coded and the daemon
could not find the actual executable.

I see two possible solutions:
1. Implement a mechanism that make a note in the monetdb_config.h
2. Implement a run time mechanism to compute the relevant file names.

Solution #1 is probably a bit more difficult because the prefix/suffix
transformation of the file names happens during the installation.

Solution #2 is already partially implemented in the daemon (see the
function get_bin_path in the file mutils.c), but will probably need to
be generalized somehow.

Comments? Ideas?

Best,
Panos.

Mark Raasveldt @ 2017-06-15 13:22 GMT:

> Changeset: 44e0bc7dab59 for MonetDB
> URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=44e0bc7dab59
> Modified Files:
> 	sql/backends/monet5/UDF/pyapi/pyapi.c
> Branch: Jul2017
> Log Message:
>
> Initialize sys.argv, because tensorflow requires this.
>
>
> diffs (20 lines):
>
> diff --git a/sql/backends/monet5/UDF/pyapi/pyapi.c b/sql/backends/monet5/UDF/pyapi/pyapi.c
> --- a/sql/backends/monet5/UDF/pyapi/pyapi.c
> +++ b/sql/backends/monet5/UDF/pyapi/pyapi.c
> @@ -1425,9 +1425,16 @@ PYFUNCNAME(PyAPIprelude)(void *ret) {
>  	MT_lock_init(&queryLock, "query_lock");
>  	MT_lock_set(&pyapiLock);
>  	if (!pyapiInitialized) {
> +#ifdef IS_PY3K
> +		wchar_t* program = Py_DecodeLocale("mserver5", NULL);
> +		wchar_t* argv[] = { program };
> +#else
> +		char* argv[] = {"mserver5"};
> +#endif
>  		str msg = MAL_SUCCEED;
>  		PyObject *tmp;
>  		Py_Initialize();
> +		PySys_SetArgvEx(1, argv, 0);
>  		_import_array();
>  		msg = _connection_init();
>  		if (msg != MAL_SUCCEED) {
> _______________________________________________
> checkin-list mailing list
> checkin-list at monetdb.org
> https://www.monetdb.org/mailman/listinfo/checkin-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://www.monetdb.org/pipermail/developers-list/attachments/20170616/6d5a786a/attachment.sig>


More information about the developers-list mailing list