Comments (7)
Hi @danjampro,
This is "expected" behavior in the sense that we know this is what the default FITS plugin does, but is of course unexpected for new users. I think this is mostly historical: when NGAS was originally developed at ESO, they wanted to have a FITS keyword to specify a filename, and use that as the final filename on storage. Note that because of this, in theory any plug-in can compute filenames in different ways, instead of relying in the filename
HTTP parameter, which serves as the default.
There are a few ways to go around this: you can take a copy of the default FITS plug-in and modify it to not take into account the ARCFILE
keyword, and use that plugin instead; you could also try to archive the file with mime_type=application/octet-stream
which would work, but you'd loose the mime type information; or you could try to add a new parameter to the FITS plug-in to skip checking for the ARCFILE
keyword and use the incoming filename
instead as the name of the file on disk.
from ngas.
Hi @rtobar, thanks for your response.
I just successfully archived a file with octet-stream. Is there a way to preserve the mime type with this approach? It would be good to avoid creating our own fork of NGAS.
Edit: Is preserving the mime type important? How does NGAS use it?
from ngas.
No, the mime_type=application/octet-stream
simply forces NGAS to use a different plug-in, as plug-ins are fully mime-type-dependent. So yes, mime-types are fairly central to the operation of the server; not only are they used for picking a archiving plug-in, but storage can also be organized around mime types, plus other details.
To adjust for your use case (a very valid one!) I just added a new ignore_arcfile
option for the FITS plug-in to ignore the ARCFILE
keyword (off by default to preserve current behavior), could you give it a try? It's in the new fits_optional_arcfile
branch. Adding an ignore_arcfile=1
HTTP parameter should be enough to activate the functionality.
from ngas.
Hit @rtobar, thanks for adding this modification. I tested it with ignore_arcfile=1 but I get the error:
dc_ngas_cache_ | Traceback (most recent call last):
dc_ngas_cache_ | File "/usr/local/lib/python3.7/site-packages/ngamsServer-11.0-py3.7.egg/ngamsServer/ngamsServer.py", line 1634, in reqCallBack
dc_ngas_cache_ | method, path, headers)
dc_ngas_cache_ | File "/usr/local/lib/python3.7/site-packages/ngamsServer-11.0-py3.7.egg/ngamsServer/ngamsServer.py", line 1728, in handleHttpRequest
dc_ngas_cache_ | ngamsCmdHandling.handle_cmd(self, reqPropsObj, httpRef)
dc_ngas_cache_ | File "/usr/local/lib/python3.7/site-packages/ngamsServer-11.0-py3.7.egg/ngamsServer/ngamsCmdHandling.py", line 63, in handle_cmd
dc_ngas_cache_ | msg = get_module(srvObj, reqPropsObj).handleCmd(srvObj, reqPropsObj, httpRef)
dc_ngas_cache | File "/usr/local/lib/python3.7/site-packages/ngamsServer-11.0-py3.7.egg/ngamsServer/commands/qarchive.py", line 80, in handleCmd
dc_ngas_cache_ | do_replication=False)
dc_ngas_cache_ | File "/usr/local/lib/python3.7/site-packages/ngamsServer-11.0-py3.7.egg/ngamsServer/ngamsArchiveUtils.py", line 1033, in dataHandler
dc_ngas_cache_ | do_replication=do_replication, transfer=transfer)
dc_ngas_cache_ | File "/usr/local/lib/python3.7/site-packages/ngamsServer-11.0-py3.7.egg/ngamsServer/ngamsArchiveUtils.py", line 1168, in dataHandler
dc_ngas_cache | plugin_result = plugInMethod(srvObj, reqPropsObj)
dc_ngas_cache_ | File "/usr/local/lib/python3.7/site-packages/ngamsPlugIns-11.0-py3.7.egg/ngamsPlugIns/ngamsFitsPlugIn.py", line 306, in ngamsFitsPlugIn
dc_ngas_cache_ | uncomprSize, archFileSize, mime, compression, crc = compress(reqPropsObj, parDic)
dc_ngas_cache_ | File "/usr/local/lib/python3.7/site-packages/ngamsPlugIns-11.0-py3.7.egg/ngamsPlugIns/ngamsFitsPlugIn.py", line 265, in compress
dc_ngas_cache_ | return uncomprSize, archFileSize, mime, compression, crc
dc_ngas_cache_ | UnboundLocalError: local variable 'crc' referenced before assignment
from ngas.
Hi @danjampro, thanks for testing these changes. In fact you just hit a different error, this time related to the configuration of compression on the server-side. I again added a test to reproduce it, and also a patch to fix it. Would you mind pulling the latest changes from the fits_optional_arcfile
branch and try again?
from ngas.
@rtobar I seem to have a talent for that!
Just tried it and looks like it worked. Here is the response:
Looks good to me - thanks a lot for your help, much appreciated.
Edit: Will this be merged with the master branch?
from ngas.
@danjampro yes, I just did the merge so I'm closing this issue now.
from ngas.
Related Issues (20)
- XML response contains invalid link to NgamsStatus DTD HOT 7
- ngamsServer and ngamsDaemon use different PID files HOT 1
- NGAMS python client --server option bug HOT 1
- Checksum calculation mismatch failure on python 3 HOT 3
- Improve path computation fixed in #80
- Deprecated function calls in src/ngamsCore/ngamsLib HOT 4
- ngamsDapiStatus attribute __ioTime: Integer vs. Float HOT 1
- ngamsCore/ngamsLib/logutils.py inconsistent types of local variable HOT 1
- ngamsCore, function isoTime2Secs() mixes Integers and Floats HOT 1
- ngamsUDT/ngamsUDTSender.py not Python3 ready HOT 1
- ngamsUtils/ngamsUtils/ngasUtilsLib.py, function decrypt_access_code() is broken HOT 2
- There is no six.input() function HOT 1
- base64 decoding of DB password is incorrect Python3 code HOT 1
- Insufficient error checks in get_db_parameters() function HOT 2
- more Python3-related changes to ngamsUtils/ngamsUtils/ngasXSyncTool.py HOT 1
- Python3-related fixes to ngamsUtils/ngamsUtils/ngasVerifyCloning.py HOT 1
- Python3-related issues in ngamsUtils/ngamsUtils/ngasCheckFileCopies.py HOT 2
- Defunct (Janitor) process after OFFLINE,ONLINE (or INIT) HOT 2
- QUERY/files command does not support UseFileIgnore=false HOT 4
- Backward compatible checksum variant HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ngas.