Skip to content

relative paths don't work after init when the current directory is changed #15173

@ehigham

Description

@ehigham

What happened?

In an ipython session

hl.init()
cd hail/hail/test/resources/
hl.import_vcf('mendel.vcf')

Version

0.2.136

Relevant log output

---------------------------------------------------------------------------
FatalError                                Traceback (most recent call last)
Cell In[5], line 1
----> 1 a = hl.import_vcf('./mendel.vcf')

File <decorator-gen-1698>:2, in import_vcf(path, force, force_bgz, header_file, min_partitions, drop_samples, call_fields, reference_genome, contig_recoding, array_elements_required, skip_invalid_loci, entry_float_type, filter, find_replace, n_partitions, block_size, _create_row_uids, _create_col_uids)

File ~/.local/src/hail/hail/python/hail/typecheck/check.py:584, in _make_dec.<locals>.wrapper(__original_func, *args, **kwargs)
    581 @decorator
    582 def wrapper(__original_func: Callable[..., T], *args, **kwargs) -> T:
    583     args_, kwargs_ = check_all(__original_func, args, kwargs, checkers, is_method=is_method)
--> 584     return __original_func(*args_, **kwargs_)

File ~/.local/src/hail/hail/python/hail/methods/impex.py:3067, in import_vcf(path, force, force_bgz, header_file, min_partitions, drop_samples, call_fields, reference_genome, contig_recoding, array_elements_required, skip_invalid_loci, entry_float_type, filter, find_replace, n_partitions, block_size, _create_row_uids, _create_col_uids)
   3044     hl.utils.warning(
   3045         f'You are trying to read {path} with *ONE* core of parallelism. This '
   3046         'will be very slow. If this file is block-gzipped (bgzip-ed), use '
   3047         'force_bgz=True instead.'
   3048     )
   3050 reader = ir.MatrixVCFReader(
   3051     path,
   3052     call_fields,
   (...)
   3065     find_replace,
   3066 )
-> 3067 return MatrixTable(
   3068     ir.MatrixRead(
   3069         reader, drop_cols=drop_samples, drop_row_uids=not _create_row_uids, drop_col_uids=not _create_col_uids
   3070     )
   3071 )

File ~/.local/src/hail/hail/python/hail/matrixtable.py:754, in MatrixTable.__init__(self, mir)
    751 self._col_indices = Indices(self, {self._col_axis})
    752 self._entry_indices = Indices(self, {self._row_axis, self._col_axis})
--> 754 self._type = self._mir.typ
    756 self._global_type = self._type.global_type
    757 self._col_type = self._type.col_type

File ~/.local/src/hail/hail/python/hail/ir/base_ir.py:494, in MatrixIR.typ(self)
    491 @property
    492 def typ(self):
    493     if self._type is None:
--> 494         self.compute_type(deep_typecheck=False)
    495     return self._type

File ~/.local/src/hail/hail/python/hail/ir/base_ir.py:485, in MatrixIR.compute_type(self, deep_typecheck)
    483 def compute_type(self, deep_typecheck):
    484     if deep_typecheck or self._type is None:
--> 485         computed = self._compute_type(deep_typecheck)
    486         if self._type is not None:
    487             assert self._type == computed

File ~/.local/src/hail/hail/python/hail/ir/matrix_ir.py:196, in MatrixRead._compute_type(self, deep_typecheck)
    194 def _compute_type(self, deep_typecheck):
    195     if self._type is None:
--> 196         return Env.backend().matrix_type(self)
    197     else:
    198         return self._type

File ~/.local/src/hail/hail/python/hail/backend/backend.py:259, in Backend.matrix_type(self, mir)
    257 def matrix_type(self, mir):
    258     payload = IRTypePayload(ir=self._render_ir(mir))
--> 259     type_bytes, _ = self._rpc(ActionTag.MATRIX_TABLE_TYPE, payload)
    260     return tmatrix._from_json(orjson.loads(type_bytes))

File ~/.local/src/hail/hail/python/hail/backend/py4j_backend.py:280, in Py4JBackend._rpc(self, action, payload)
    278 if resp.status_code >= 400:
    279     error_json = orjson.loads(resp.content)
--> 280     raise fatal_error_from_java_error_triplet(
    281         error_json['short'], error_json['expanded'], error_json['error_id']
    282     )
    284 return resp.content, parse_timings(resp.headers.get('X-Hail-Timings', None))

FatalError: HailException: arguments refer to no files: Vector(./mendel.vcf).

Java stack trace:
is.hail.utils.HailException: arguments refer to no files: Vector(./mendel.vcf).
        at is.hail.utils.ErrorHandling.fatal(ErrorHandling.scala:19)
        at is.hail.utils.ErrorHandling.fatal$(ErrorHandling.scala:19)
        at is.hail.utils.package$.fatal(package.scala:110)
        at is.hail.utils.package$.checkGzipOfGlobbedFiles(package.scala:176)
        at is.hail.io.vcf.MatrixVCFReader$.apply(LoadVCF.scala:1790)
        at is.hail.io.vcf.MatrixVCFReader$.fromJValue(LoadVCF.scala:1877)
        at is.hail.expr.ir.MatrixReader$.fromJson(MatrixIR.scala:106)
        at is.hail.expr.ir.IRParser$.matrix_ir_1(Parser.scala:1809)
        at is.hail.expr.ir.IRParser$.$anonfun$matrix_ir$1(Parser.scala:1732)
        at is.hail.utils.StackSafe$More.advance(StackSafe.scala:64)
        at is.hail.utils.StackSafe$.run(StackSafe.scala:16)
        at is.hail.utils.StackSafe$StackFrame.run(StackSafe.scala:32)
        at is.hail.expr.ir.IRParser$.$anonfun$parse_matrix_ir$2(Parser.scala:2134)
        at is.hail.expr.ir.IRParser$.parse(Parser.scala:2112)
        at is.hail.expr.ir.IRParser$.$anonfun$parse_matrix_ir$1(Parser.scala:2134)
        at is.hail.utils.ExecutionTimer.time(ExecutionTimer.scala:98)
        at is.hail.backend.ExecuteContext.time(ExecuteContext.scala:170)
        at is.hail.expr.ir.IRParser$.parse_matrix_ir(Parser.scala:2133)
        at is.hail.backend.driver.BackendRpc.$anonfun$runRpc$1(BackendRpc.scala:87)
        at is.hail.backend.ExecuteContext$.$anonfun$scoped$3(ExecuteContext.scala:94)
        at is.hail.utils.package$.using(package.scala:718)
        at is.hail.backend.ExecuteContext$.$anonfun$scoped$2(ExecuteContext.scala:94)
        at is.hail.utils.package$.using(package.scala:718)
        at is.hail.annotations.RegionPool.scopedRegion(RegionPool.scala:166)
        at is.hail.backend.ExecuteContext$.$anonfun$scoped$1(ExecuteContext.scala:77)
        at is.hail.utils.package$.using(package.scala:718)
        at is.hail.annotations.RegionPool$.scoped(RegionPool.scala:13)
        at is.hail.backend.ExecuteContext$.scoped(ExecuteContext.scala:76)
        at is.hail.backend.driver.Py4JQueryDriver.$anonfun$withExecuteContext$1(Py4JQueryDriver.scala:340)
        at is.hail.utils.ExecutionTimer$.time(ExecutionTimer.scala:15)
        at is.hail.backend.driver.Py4JQueryDriver.is$hail$backend$driver$Py4JQueryDriver$$withExecuteContext(Py4JQueryDriver.scala:322)
        at is.hail.backend.driver.Py4JQueryDriver$$anon$1$Context$.scoped(Py4JQueryDriver.scala:430)
        at is.hail.backend.driver.Py4JQueryDriver$$anon$1$Context$.scoped(Py4JQueryDriver.scala:428)
        at is.hail.backend.driver.BackendRpc.runRpc(BackendRpc.scala:80)
        at is.hail.backend.driver.BackendRpc.runRpc$(BackendRpc.scala:76)
        at is.hail.backend.driver.Py4JQueryDriver$$anon$1.runRpc(Py4JQueryDriver.scala:379)
        at is.hail.backend.driver.Py4JQueryDriver$$anon$1.$anonfun$new$1(Py4JQueryDriver.scala:438)
        at jdk.httpserver/com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:77)
        at jdk.httpserver/sun.net.httpserver.AuthFilter.doFilter(AuthFilter.java:82)
        at jdk.httpserver/com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:80)
        at jdk.httpserver/sun.net.httpserver.ServerImpl$Exchange$LinkHandler.handle(ServerImpl.java:849)
        at jdk.httpserver/com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:77)
        at jdk.httpserver/sun.net.httpserver.ServerImpl$Exchange.run(ServerImpl.java:818)
        at jdk.httpserver/sun.net.httpserver.ServerImpl$DefaultExecutor.execute(ServerImpl.java:201)
        at jdk.httpserver/sun.net.httpserver.ServerImpl$Dispatcher.handle(ServerImpl.java:560)
        at jdk.httpserver/sun.net.httpserver.ServerImpl$Dispatcher.run(ServerImpl.java:526)
        at java.base/java.lang.Thread.run(Thread.java:834)



Hail version: 0.2.136-052c838641f0
Error summary: HailException: arguments refer to no files: Vector(./mendel.vcf).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions