Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ export const AudinoJobRequestForm = () => {
gtPath,
userGuide,
accuracyTarget,
audioDuration,
segmentDuration,
}: ReturnType<typeof mapAudinoFormValues>) => {
updateJobRequest({
Expand Down Expand Up @@ -116,7 +115,6 @@ export const AudinoJobRequestForm = () => {
},
userGuide,
accuracyTarget,
audioDuration,
segmentDuration,
},
});
Expand Down Expand Up @@ -599,36 +597,6 @@ export const AudinoJobRequestForm = () => {
</Grid>
</Grid>
<Grid item container xs={12} spacing={2}>
<Grid item xs={12} sm={12} md={6}>
<FormControl fullWidth>
<TextField
name="audioDuration"
value={values.audioDuration}
onChange={(e) =>
setFieldValue('audioDuration', e.target.value)
}
onBlur={handleBlur}
placeholder="Audio duration"
label="Audio duration (seconds)"
error={
touched.audioDuration && Boolean(errors.audioDuration)
}
helperText={errors.audioDuration}
InputProps={{
endAdornment: (
<InputAdornment position="end">
<Tooltip title="This field should contain total audio duration in seconds. This value will be used later to calculate job bounty">
<HelpOutlineIcon
color="secondary"
sx={{ cursor: 'pointer' }}
/>
</Tooltip>
</InputAdornment>
),
}}
/>
</FormControl>
</Grid>
<Grid item xs={12} sm={12} md={6}>
<FormControl fullWidth>
<TextField
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ export const mapAudinoFormValues = (
userGuide: audinoRequest?.userGuide || '',
accuracyTarget: audinoRequest?.accuracyTarget || 50,

audioDuration: audinoRequest?.audioDuration || 0,
segmentDuration: audinoRequest?.segmentDuration || 0,
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -109,18 +109,8 @@ export const AudinoJobRequestValidationSchema = Yup.object().shape({
.moreThan(0, 'Accuracy target must be greater than 0')
.max(100, 'Accuracy target must be less than or equal to 100'),
qualifications: Yup.array().of(Yup.object()),

audioDuration: Yup.number()
.required('Audio duration is required')
.moreThan(0, 'Audio duration must be greater than 0')
.max(31536000, 'Audio duration must be less than or equal to 31536000'), // one year in seconds
segmentDuration: Yup.number()
.required('Segment duration is required')
.moreThan(0, 'Segment duration must be greater than 0')
.when('$audioDuration', ([audioDuration], schema) => {
return schema.max(
audioDuration * 1000,
'Segment duration should not exceed audio duration',
);
}),
.max(3600000, 'Segment duration must be less than or equal to 3600000'), // one hour in ms
});
1 change: 0 additions & 1 deletion packages/apps/job-launcher/client/src/services/job.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ export const createAudinoJob = async (
userGuide: data.userGuide,
type: data.type,
qualifications: data.qualifications,
audioDuration: Number(data.audioDuration),
segmentDuration: Number(data.segmentDuration),
};

Expand Down
2 changes: 0 additions & 2 deletions packages/apps/job-launcher/client/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ export type CreateAudinoJobRequest = {
groundTruth: AudinoDataSource;
userGuide: string;
type: AudinoJobType;
audioDuration: number;
segmentDuration: number;
};

Expand Down Expand Up @@ -284,7 +283,6 @@ export type AudinoRequest = {
groundTruth: AudinoDataSource;
userGuide: string;
accuracyTarget: number;
audioDuration: number;
segmentDuration: number;
};

Expand Down
5 changes: 0 additions & 5 deletions packages/apps/job-launcher/server/src/modules/job/job.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,11 +247,6 @@ export class JobAudinoDto extends JobDto {
@IsEnumCaseInsensitive(AudinoJobType)
public type: AudinoJobType;

@ApiProperty({ name: 'audio_duration' })
@IsNumber()
@IsPositive()
public audioDuration: number;

@ApiProperty({ name: 'segment_duration' })
@IsNumber()
@IsPositive()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,7 @@ export function createJobAudinoDto(
path: faker.system.filePath(),
},
labels: [{ name: faker.lorem.word() }],
audioDuration: faker.number.int({ min: 100, max: 1000 }),
segmentDuration: faker.number.int({ min: 10, max: 100 }),
segmentDuration: faker.number.int({ min: 10, max: 3600000 }),
requesterDescription: faker.lorem.sentence(),
userGuide: faker.internet.url(),
qualifications: [faker.lorem.word()],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,6 @@ export class AudinoManifestDto {
@ValidateNested()
@Type(() => AudinoValidation)
public validation: AudinoValidation;

@IsString()
public job_bounty: string;
}

export class RestrictedAudience {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { faker } from '@faker-js/faker';
import { createMock } from '@golevelup/ts-jest';
import { Encryption } from '@human-protocol/sdk';
import { Test } from '@nestjs/testing';
import { ethers } from 'ethers';
import { AuthConfigService } from '../../common/config/auth-config.service';
import { CvatConfigService } from '../../common/config/cvat-config.service';
import { PGPConfigService } from '../../common/config/pgp-config.service';
Expand Down Expand Up @@ -314,13 +313,6 @@ describe('ManifestService', () => {
mockTokenFundDecimals,
);

const totalSegments = Math.ceil(
(mockDto.audioDuration * 1000) / mockDto.segmentDuration,
);
const jobBounty =
ethers.parseUnits(mockTokenFundAmount.toString(), 'ether') /
BigInt(totalSegments);

expect(result).toEqual({
annotation: {
description: mockDto.requesterDescription,
Expand All @@ -334,7 +326,6 @@ describe('ManifestService', () => {
data_url: generateBucketUrl(mockDto.data.dataset, mockRequestType)
.href,
},
job_bounty: ethers.formatEther(jobBounty),
validation: {
gt_url: generateBucketUrl(mockDto.groundTruth, mockRequestType)
.href,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,7 @@ export class ManifestService {
);

case AudinoJobType.AUDIO_TRANSCRIPTION:
return this.createAudinoManifest(
dto as JobAudinoDto,
requestType,
fundAmount,
);
return this.createAudinoManifest(dto as JobAudinoDto, requestType);

default:
throw new ValidationError(ErrorJob.InvalidRequestType);
Expand Down Expand Up @@ -330,16 +326,7 @@ export class ManifestService {
private async createAudinoManifest(
dto: JobAudinoDto,
requestType: AudinoJobType,
tokenFundAmount: number,
): Promise<any> {
const totalSegments = Math.ceil(
(dto.audioDuration * 1000) / dto.segmentDuration,
);

const jobBounty =
ethers.parseUnits(tokenFundAmount.toString(), 'ether') /
BigInt(totalSegments);

): Promise<AudinoManifestDto> {
return {
annotation: {
description: dto.requesterDescription,
Expand All @@ -352,7 +339,6 @@ export class ManifestService {
data: {
data_url: generateBucketUrl(dto.data.dataset, requestType).href,
},
job_bounty: ethers.formatEther(jobBounty),
validation: {
gt_url: generateBucketUrl(dto.groundTruth, requestType).href,
min_quality: dto.minQuality,
Expand Down