timewise 0.5.2__tar.gz → 0.5.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,14 +1,13 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: timewise
3
- Version: 0.5.2
3
+ Version: 0.5.3
4
4
  Summary: A small package to download infrared data from the WISE satellite
5
5
  License: MIT
6
6
  Author: Jannis Necker
7
7
  Author-email: jannis.necker@gmail.com
8
- Requires-Python: >=3.8,<3.12
8
+ Requires-Python: >=3.9,<3.12
9
9
  Classifier: License :: OSI Approved :: MIT License
10
10
  Classifier: Programming Language :: Python :: 3
11
- Classifier: Programming Language :: Python :: 3.8
12
11
  Classifier: Programming Language :: Python :: 3.9
13
12
  Classifier: Programming Language :: Python :: 3.10
14
13
  Classifier: Programming Language :: Python :: 3.11
@@ -25,7 +24,7 @@ Requires-Dist: numpy (>=1.23.2,<2.0.0)
25
24
  Requires-Dist: pandas (>=1.4.3,<3.0.0)
26
25
  Requires-Dist: pydantic (>=1.9.0,<2.0.0)
27
26
  Requires-Dist: pytest (>=7.2.2,<8.0.0) ; extra == "dev"
28
- Requires-Dist: pyvo (>=1.4.1,<2.0.0)
27
+ Requires-Dist: pyvo (>=1.7.0,<2.0.0)
29
28
  Requires-Dist: requests (>=2.28.1,<3.0.0)
30
29
  Requires-Dist: scikit-image (>=0.19.3,<0.22.0)
31
30
  Requires-Dist: scikit-learn (>=1.3.0,<2.0.0)
@@ -4,20 +4,20 @@ build-backend = "poetry.core.masonry.api"
4
4
 
5
5
  [project]
6
6
  name = "timewise"
7
- version = "0.5.2"
7
+ version = "0.5.3"
8
8
  description = "A small package to download infrared data from the WISE satellite"
9
9
  authors = [
10
10
  { name = "Jannis Necker", email = "jannis.necker@gmail.com" },
11
11
  ]
12
12
  license = { text = "MIT" }
13
13
  readme = "README.md"
14
- requires-python = ">=3.8,<3.12"
14
+ requires-python = ">=3.9,<3.12"
15
15
  dependencies = [
16
16
  "tqdm>=4.64.0,<5.0.0",
17
17
  "requests>=2.28.1,<3.0.0",
18
18
  "pandas>=1.4.3,<3.0.0",
19
19
  "numpy>=1.23.2,<2.0.0",
20
- "pyvo>=1.4.1,<2.0.0",
20
+ "pyvo>=1.7.0,<2.0.0",
21
21
  "astropy>=5.1,<6.0.0",
22
22
  "matplotlib>=3.5.3,<4.0.0",
23
23
  "scikit-image>=0.19.3,<0.22.0",
@@ -1,3 +1,5 @@
1
1
  from timewise.wise_data_by_visit import WiseDataByVisit
2
2
  from timewise.wise_bigdata_desy_cluster import WISEDataDESYCluster
3
3
  from timewise.parent_sample_base import ParentSampleBase
4
+
5
+ __version__ = "0.5.3"
@@ -431,9 +431,48 @@ def get_excess_variance(y, y_err, mu):
431
431
 
432
432
  class StableAsyncTAPJob(vo.dal.AsyncTAPJob):
433
433
  """
434
- Implements backoff for call of phase which otherwise breaks the code if there are connection issues
434
+ Implements backoff for call of phase which otherwise breaks the code if there are connection issues.
435
+ Also stores the response of TapQuery.submit() under self.submit_response for debugging
435
436
  """
436
437
 
438
+ def __init__(self, url, *, session=None, delete=True):
439
+ super(StableAsyncTAPJob, self).__init__(url, session=session, delete=delete)
440
+ self.submit_response = None
441
+
442
+ @classmethod
443
+ def create(
444
+ cls, baseurl, query, *, language="ADQL", maxrec=None, uploads=None,
445
+ session=None, **keywords):
446
+ """
447
+ creates a async tap job on the server under ``baseurl``
448
+ Raises requests.HTTPError if TAPQuery.submit() failes.
449
+
450
+ Parameters
451
+ ----------
452
+ baseurl : str
453
+ the TAP baseurl
454
+ query : str
455
+ the query string
456
+ language : str
457
+ specifies the query language, default ADQL.
458
+ useful for services which allow to use the backend query language.
459
+ maxrec : int
460
+ the maximum records to return. defaults to the service default
461
+ uploads : dict
462
+ a mapping from table names to objects containing a votable
463
+ session : object
464
+ optional session to use for network requests
465
+ """
466
+ tapquery = vo.dal.TAPQuery(
467
+ baseurl, query, mode="async", language=language, maxrec=maxrec,
468
+ uploads=uploads, session=session, **keywords)
469
+ response = tapquery.submit()
470
+ response.raise_for_status()
471
+ job = cls(response.url, session=session)
472
+ job._client_set_maxrec = maxrec
473
+ job.submit_response = response
474
+ return job
475
+
437
476
  @property
438
477
  @backoff.on_exception(
439
478
  backoff.expo,
@@ -453,6 +492,7 @@ class StableTAPService(vo.dal.TAPService):
453
492
  def submit_job(
454
493
  self,
455
494
  query,
495
+ *,
456
496
  language="ADQL",
457
497
  maxrec=None,
458
498
  uploads=None,
@@ -461,10 +501,10 @@ class StableTAPService(vo.dal.TAPService):
461
501
  return StableAsyncTAPJob.create(
462
502
  self.baseurl,
463
503
  query,
464
- language,
465
- maxrec,
466
- uploads,
467
- self._session,
504
+ language=language,
505
+ maxrec=maxrec,
506
+ uploads=uploads,
507
+ session=self._session,
468
508
  **keywords
469
509
  )
470
510
 
@@ -1147,9 +1147,14 @@ class WISEDataBase(abc.ABC):
1147
1147
  try:
1148
1148
  job = self.service.submit_job(qstring, uploads={'ids': Table(tab_d)})
1149
1149
  job.run()
1150
+ logger.debug(job.url)
1151
+ time.sleep(5) # wait a bit until checking phase
1150
1152
 
1151
1153
  if isinstance(job.phase, type(None)):
1152
- raise vo.dal.DALServiceError(f"Job submission failed. No phase!")
1154
+ raise vo.dal.DALServiceError(
1155
+ f"Job submission failed. No phase!"
1156
+ f"response: {job.submit_response}"
1157
+ )
1153
1158
 
1154
1159
  logger.info(f'submitted job for {t} for chunk {i}: ')
1155
1160
  logger.debug(f'Job: {job.url}; {job.phase}')
@@ -1157,7 +1162,11 @@ class WISEDataBase(abc.ABC):
1157
1162
  self.queue.put((t, i))
1158
1163
  break
1159
1164
 
1160
- except (requests.exceptions.ConnectionError, vo.dal.exceptions.DALServiceError) as e:
1165
+ except (
1166
+ requests.exceptions.ConnectionError,
1167
+ vo.dal.exceptions.DALServiceError,
1168
+ requests.HTTPError
1169
+ ) as e:
1161
1170
  wait = 60
1162
1171
  N_tries -= 1
1163
1172
  logger.warning(f"{chunk_number}th query of {table_name}: Could not submit TAP job!\n"
File without changes
File without changes
File without changes
File without changes