AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / coding / 问题

问题[module](coding)

Martin Hope
Rea Kalampaliki
Asked: 2025-04-24 03:19:35 +0800 CST

Nextflow:在流程执行期间未找到自定义模块中的 Python 脚本

  • 6

我正在开发一个使用自定义模块的 Nextflow 管道。该模块包含一个script_1.py位于嵌套文件夹 中的 Python 脚本 ( ) <module-dir>/resources/usr/bin。script_1.py已设置为可执行文件,并且已在文件中nextflow.enable.moduleBinaries设置为。但是,当我尝试运行该管道时,出现找不到 Python 脚本的错误。true./nextflow.config

模块目录结构

modules/
└── local/
    └── mymodule/
        ├── environment.yml
        ├── main.nf
        ├── resources/
        │   └── usr/
        │       └── bin/
        │           └── script_1.py
        └── work/

错误信息

这是我在运行管道时遇到的错误:

Caused by:
  Process `MyProcess (1)` terminated with an error exit status (2)

Command executed:

  python script_1.py

  cat <<-END_VERSIONS > versions.yml
      "MyProcess":
          python: $(python --version 2>&1 | sed 's/Python //g')
  END_VERSIONS

Command exit status:
  2

Command output:
  (empty)

Command error:
  python: can't open file 'script_1.py': [Errno 2] No such file or directory

我尝试过

在我的 中main.nf,我有以下内容:

#!/usr/bin/env nextflow

include { MyProcess } from './modules/local/mymodule/main.nf'

在我的 中./modules/local/mymodule/main.nf,我有以下内容:

#!/usr/bin/env nextflow

process MyProcess{
    conda "${moduleDir}/environment.yml"

    input:
    path(input_folder)
    
    output:
    path("data.csv")
    path "versions.yml"                , emit: versions

    script:
    """
    python script_1.py ${input_folder}

cat <<-END_VERSIONS > versions.yml
    "${task.process}":
        python: \$(python --version 2>&1 | sed 's/Python //g')
    END_VERSIONS
    """ 
    
}

但script_1.py始终找不到,并且过程失败。

我的问题

这是在 Nextflow 管道中的模块中引用此类脚本的正确方法吗?

module
  • 1 个回答
  • 26 Views
Martin Hope
Ba Loc Dang
Asked: 2024-11-13 18:01:26 +0800 CST

Nest 无法解析 UserService 的依赖项(?)。请确保索引 [0] 处的参数在当前上下文中可用

  • 5

遇到了一些问题,di/circular-references 我确定我做错了,但我只是看不到它。

任何帮助都将不胜感激

用户.模块.ts

import { Module } from '@nestjs/common';
import { UserService } from './user.service';
import { UserController } from './user.controller';
import { PrismaService } from 'src/prisma/prisma.service';

@Module({
  controllers: [UserController],
  providers: [UserService, PrismaService],
})
export class UserModule {}

用户.服务.ts

import { Injectable } from '@nestjs/common';
import type { PrismaService } from 'src/prisma/prisma.service';
import type { CreateUserDto } from './dto/create-user.dto';
import { hash } from 'argon2';

@Injectable()
export class UserService {
  constructor(private readonly prisma: PrismaService) {}

  async create(createUserDto: CreateUserDto) {
    const { password, ...user } = createUserDto;
    const hashedPassword = await hash(password);
    return await this.prisma.users.create({
      data: {
        password: hashedPassword,
        ...user,
      },
    });
  }

  async findByEmail(email: string) {
    this.prisma.users.findUnique({
      where: {
        email,
      },
    });
  }
}

身份验证模块

import { Module } from '@nestjs/common';
import { AuthService } from './auth.service';
import { AuthController } from './auth.controller';
import { UserService } from 'src/user/user.service';
import { PrismaService } from 'src/prisma/prisma.service';

@Module({
  controllers: [AuthController],
  providers: [AuthService, UserService, PrismaService],
})
export class AuthModule {}

身份验证服务

import {
      ConflictException,
      forwardRef,
      Inject,
      Injectable,
    } from '@nestjs/common';
    import type { CreateUserDto } from 'src/user/dto/create-user.dto';
    import { UserService } from 'src/user/user.service';
    
    @Injectable()
    export class AuthService {
      constructor(
        @Inject(forwardRef(() => UserService))
        private readonly userService: UserService,
      ) {}
    
      registerUser(createUserDto: CreateUserDto) {
        const user = this.userService.findByEmail(createUserDto.email);
        if (user) throw new ConflictException('User already exists!');
        return this.userService.create(createUserDto);
      }
    }

应用程序.模块.ts

import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { PrismaService } from './prisma/prisma.service';
import { AuthModule } from './auth/auth.module';
import { UserModule } from './user/user.module';

@Module({
  imports: [AuthModule, UserModule],
  controllers: [AppController],
  providers: [AppService, PrismaService],
})
export class AppModule {}
ERROR [ExceptionHandler] Nest can't resolve dependencies of the UserService (?). Please make sure that the argument Function at index [0] is available in the AuthModule context.

Potential solutions:
- Is AuthModule a valid NestJS module?
- If Function is a provider, is it part of the current AuthModule?
- If Function is exported from a separate @Module, is that module imported within AuthModule?
  @Module({
    imports: [ /* the Module containing Function */ ]
  })

Error: Nest can't resolve dependencies of the UserService (?). Please make sure that the argument Function at index [0] is available in the AuthModule context.

Potential solutions:
- Is AuthModule a valid NestJS module?
- If Function is a provider, is it part of the current AuthModule?
- If Function is exported from a separate @Module, is that module imported within AuthModule?
  @Module({
    imports: [ /* the Module containing Function */ ]
  })

最初有“Nest 无法解析 的依赖关系UserService。然后我完全删除了UserModule并只使用了AuthModule,一切正常。你能告诉我我错在哪里吗?提前谢谢。

module
  • 1 个回答
  • 39 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    重新格式化数字,在固定位置插入分隔符

    • 6 个回答
  • Marko Smith

    为什么 C++20 概念会导致循环约束错误,而老式的 SFINAE 不会?

    • 2 个回答
  • Marko Smith

    VScode 自动卸载扩展的问题(Material 主题)

    • 2 个回答
  • Marko Smith

    Vue 3:创建时出错“预期标识符但发现‘导入’”[重复]

    • 1 个回答
  • Marko Smith

    具有指定基础类型但没有枚举器的“枚举类”的用途是什么?

    • 1 个回答
  • Marko Smith

    如何修复未手动导入的模块的 MODULE_NOT_FOUND 错误?

    • 6 个回答
  • Marko Smith

    `(表达式,左值) = 右值` 在 C 或 C++ 中是有效的赋值吗?为什么有些编译器会接受/拒绝它?

    • 3 个回答
  • Marko Smith

    在 C++ 中,一个不执行任何操作的空程序需要 204KB 的堆,但在 C 中则不需要

    • 1 个回答
  • Marko Smith

    PowerBI 目前与 BigQuery 不兼容:Simba 驱动程序与 Windows 更新有关

    • 2 个回答
  • Marko Smith

    AdMob:MobileAds.initialize() - 对于某些设备,“java.lang.Integer 无法转换为 java.lang.String”

    • 1 个回答
  • Martin Hope
    Fantastic Mr Fox msvc std::vector 实现中仅不接受可复制类型 2025-04-23 06:40:49 +0800 CST
  • Martin Hope
    Howard Hinnant 使用 chrono 查找下一个工作日 2025-04-21 08:30:25 +0800 CST
  • Martin Hope
    Fedor 构造函数的成员初始化程序可以包含另一个成员的初始化吗? 2025-04-15 01:01:44 +0800 CST
  • Martin Hope
    Petr Filipský 为什么 C++20 概念会导致循环约束错误,而老式的 SFINAE 不会? 2025-03-23 21:39:40 +0800 CST
  • Martin Hope
    Catskul C++20 是否进行了更改,允许从已知绑定数组“type(&)[N]”转换为未知绑定数组“type(&)[]”? 2025-03-04 06:57:53 +0800 CST
  • Martin Hope
    Stefan Pochmann 为什么 {2,3,10} 和 {x,3,10} (x=2) 的顺序不同? 2025-01-13 23:24:07 +0800 CST
  • Martin Hope
    Chad Feller 在 5.2 版中,bash 条件语句中的 [[ .. ]] 中的分号现在是可选的吗? 2024-10-21 05:50:33 +0800 CST
  • Martin Hope
    Wrench 为什么双破折号 (--) 会导致此 MariaDB 子句评估为 true? 2024-05-05 13:37:20 +0800 CST
  • Martin Hope
    Waket Zheng 为什么 `dict(id=1, **{'id': 2})` 有时会引发 `KeyError: 'id'` 而不是 TypeError? 2024-05-04 14:19:19 +0800 CST
  • Martin Hope
    user924 AdMob:MobileAds.initialize() - 对于某些设备,“java.lang.Integer 无法转换为 java.lang.String” 2024-03-20 03:12:31 +0800 CST

热门标签

python javascript c++ c# java typescript sql reactjs html

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve