From c680a6e51d5b0a605423b4649191f78223ca3d21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D0=BE=D1=84=D1=8C=D1=8F=20=D0=9E=D1=81=D1=82=D1=80?= =?UTF-8?q?=D0=BE=D0=B2=D1=81=D0=BA=D0=B0=D1=8F?= Date: Tue, 10 Oct 2023 16:55:06 +0400 Subject: [PATCH 1/2] laba done --- .config/dotnet-tools.json | 5 + tasks/ostrovskaya-sf/lab_2/.gitignore | 454 ++++++++++++++++++ tasks/ostrovskaya-sf/lab_2/README.md | 67 +++ tasks/ostrovskaya-sf/lab_2/data/1.txt | 0 tasks/ostrovskaya-sf/lab_2/data/data.txt | 4 + tasks/ostrovskaya-sf/lab_2/data/sonya.txt | 0 tasks/ostrovskaya-sf/lab_2/docker-compose.yml | 18 + tasks/ostrovskaya-sf/lab_2/lab_2.sln | 48 ++ tasks/ostrovskaya-sf/lab_2/pic1.png | Bin 0 -> 3275 bytes tasks/ostrovskaya-sf/lab_2/pic2.png | Bin 0 -> 8563 bytes tasks/ostrovskaya-sf/lab_2/result-1/data.txt | 3 + tasks/ostrovskaya-sf/lab_2/result/result.txt | 1 + .../ostrovskaya-sf/lab_2/worker-1/Dockerfile | 17 + .../ostrovskaya-sf/lab_2/worker-1/Program.cs | 34 ++ .../lab_2/worker-1/worker-1.csproj | 9 + .../ostrovskaya-sf/lab_2/worker-2/Dockerfile | 17 + .../ostrovskaya-sf/lab_2/worker-2/Program.cs | 34 ++ .../lab_2/worker-2/worker-2.csproj | 9 + 18 files changed, 720 insertions(+) create mode 100644 .config/dotnet-tools.json create mode 100644 tasks/ostrovskaya-sf/lab_2/.gitignore create mode 100644 tasks/ostrovskaya-sf/lab_2/README.md create mode 100644 tasks/ostrovskaya-sf/lab_2/data/1.txt create mode 100644 tasks/ostrovskaya-sf/lab_2/data/data.txt create mode 100644 tasks/ostrovskaya-sf/lab_2/data/sonya.txt create mode 100644 tasks/ostrovskaya-sf/lab_2/docker-compose.yml create mode 100644 tasks/ostrovskaya-sf/lab_2/lab_2.sln create mode 100644 tasks/ostrovskaya-sf/lab_2/pic1.png create mode 100644 tasks/ostrovskaya-sf/lab_2/pic2.png create mode 100644 tasks/ostrovskaya-sf/lab_2/result-1/data.txt create mode 100644 tasks/ostrovskaya-sf/lab_2/result/result.txt create mode 100644 tasks/ostrovskaya-sf/lab_2/worker-1/Dockerfile create mode 100644 tasks/ostrovskaya-sf/lab_2/worker-1/Program.cs create mode 100644 tasks/ostrovskaya-sf/lab_2/worker-1/worker-1.csproj create mode 100644 tasks/ostrovskaya-sf/lab_2/worker-2/Dockerfile create mode 100644 tasks/ostrovskaya-sf/lab_2/worker-2/Program.cs create mode 100644 tasks/ostrovskaya-sf/lab_2/worker-2/worker-2.csproj diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json new file mode 100644 index 0000000..b0e38ab --- /dev/null +++ b/.config/dotnet-tools.json @@ -0,0 +1,5 @@ +{ + "version": 1, + "isRoot": true, + "tools": {} +} \ No newline at end of file diff --git a/tasks/ostrovskaya-sf/lab_2/.gitignore b/tasks/ostrovskaya-sf/lab_2/.gitignore new file mode 100644 index 0000000..8afdcb6 --- /dev/null +++ b/tasks/ostrovskaya-sf/lab_2/.gitignore @@ -0,0 +1,454 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# Tye +.tye/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd + +## +## Visual studio for Mac +## + + +# globs +Makefile.in +*.userprefs +*.usertasks +config.make +config.status +aclocal.m4 +install-sh +autom4te.cache/ +*.tar.gz +tarballs/ +test-results/ + +# Mac bundle stuff +*.dmg +*.app + +# content below from: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +# content below from: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore +# Windows thumbnail cache files +Thumbs.db +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +# JetBrains Rider +.idea/ +*.sln.iml + +## +## Visual Studio Code +## +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json diff --git a/tasks/ostrovskaya-sf/lab_2/README.md b/tasks/ostrovskaya-sf/lab_2/README.md new file mode 100644 index 0000000..23fc80a --- /dev/null +++ b/tasks/ostrovskaya-sf/lab_2/README.md @@ -0,0 +1,67 @@ +# Отчёт по лабораторной работе №2 + +Выполнила: студентка гр. ИСЭбд-41 Островская Софья. + +Вариант программы 1: + +4. Формирует файл `/var/result/data.txt` так, что каждая строка файла - количество символов в именах файлов из каталога `/var/data`. + +Вариант программы 2: + +0. Сохраняет произведение первого и последнего числа из файла `/var/data/data.txt` в `/var/result/result.txt`. + +## Создание приложений + +Создадим 2 приложения. +Был выбран язык C# и технология .NET 5. + +Для создания обычных консольных приложений воспользуемся командами: + +```sh +dotnet new console -o worker-1 +dotnet new console -o worker-2 +``` + +Согласно варианту, программа 1 должна сформировать файл `/var/result/data.txt`, в который построчно будут записаны числа, равные количеству символов в именах файлах каталога `/var/data`. + +[Исходный текст программы worker-1](worker-1/Program.cs) + +Согласно варианту, программа 2 должна взять первое и последнее число из файла `/var/data/data.txt`, затем выполнить операцию произведения и записать результат в `/var/result/result.txt`. + +[Исходный текст программы worker-2](worker-2/Program.cs) + +Дополнительно создан файл [.gitignore](.gitignore) для того, чтобы не закоммитить в git ничего лишнего. + +## Настройка окружения + +Для связи двух приложений воспользуемся следующей схемой: + +1. Каталог `./data` должен быть примонтирован в каталог `/var/data` для программы 1. + Оттуда будут браться исходные данные. +2. Каталог `./result-1` должен быть примонтирован в каталог `/var/result` для программы 2. + Туда будут складываться промежуточные данные. +3. Каталог `./result-1` также должен быть примонтирован в каталог `/var/data` для программы 2. + Оттуда будут браться промежуточные результаты. +4. Каталог `./result` должен быть примонтирован в каталог `/var/result` для программы 2. + Туда будут складывать результаты финальной обработки. + +Для каждой программы были созданы файлы Dockerfile ([программа 1](worker-1/Dockerfile), [программа 2](worker-2/Dockerfile)) с подробным описанием процесса сборки. + +Был создан файл [docker-compose.yml](docker-compose.yml), в котором указан манифест для запуска распределённого приложения. + +## Сборка и запуск + +В каталог `./data` помещены 3 файла с различной длиной названия. + +![](pic1.png) + +На выходе, программа должна сначала записать числа [5 8 9], поскольку именно такую длину имеют файлы (вместе с расширением). А затем, умножив 5 на 9, получится результат программы 2, равный 45 + +Для запуска приложения необходимо ввести команду `docker compose up --build`. +Результат запуска после сборки: + +![](pic2.png) + +В результате в каталоге `./result` создался файл `result.txt` с содержимым `45`. + +Изменение значений в файлах из каталога `./data` также изменяет содержимое в файлах из каталогов `./result-1` и `./result`. \ No newline at end of file diff --git a/tasks/ostrovskaya-sf/lab_2/data/1.txt b/tasks/ostrovskaya-sf/lab_2/data/1.txt new file mode 100644 index 0000000..e69de29 diff --git a/tasks/ostrovskaya-sf/lab_2/data/data.txt b/tasks/ostrovskaya-sf/lab_2/data/data.txt new file mode 100644 index 0000000..b178657 --- /dev/null +++ b/tasks/ostrovskaya-sf/lab_2/data/data.txt @@ -0,0 +1,4 @@ +1 +2 +3 +4 \ No newline at end of file diff --git a/tasks/ostrovskaya-sf/lab_2/data/sonya.txt b/tasks/ostrovskaya-sf/lab_2/data/sonya.txt new file mode 100644 index 0000000..e69de29 diff --git a/tasks/ostrovskaya-sf/lab_2/docker-compose.yml b/tasks/ostrovskaya-sf/lab_2/docker-compose.yml new file mode 100644 index 0000000..9c753e7 --- /dev/null +++ b/tasks/ostrovskaya-sf/lab_2/docker-compose.yml @@ -0,0 +1,18 @@ +version: "3.1" +services: + worker-1: + build: ./worker-1 + volumes: + # Монтирует локальную папку data к папке data в контейнере. + - ./data:/var/data + # Монтирует локальную папку result-1 к папке result в контейнере. + - ./result-1:/var/result + worker-2: + build: ./worker-2 + volumes: + # Монтирует локальную папку result-1 к папке data в контейнере. + - ./result-1:/var/data + - ./result:/var/result + # Зависимость от первого приложения. + depends_on: + - worker-1 \ No newline at end of file diff --git a/tasks/ostrovskaya-sf/lab_2/lab_2.sln b/tasks/ostrovskaya-sf/lab_2/lab_2.sln new file mode 100644 index 0000000..c30048f --- /dev/null +++ b/tasks/ostrovskaya-sf/lab_2/lab_2.sln @@ -0,0 +1,48 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30114.105 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "worker-1", "worker-1\worker-1.csproj", "{27BD1451-9A65-4578-8694-DDA354866DA3}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "worker-2", "worker-2\worker-2.csproj", "{AD4D5CF8-D33E-45A5-B30E-FB86133562EC}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {27BD1451-9A65-4578-8694-DDA354866DA3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {27BD1451-9A65-4578-8694-DDA354866DA3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {27BD1451-9A65-4578-8694-DDA354866DA3}.Debug|x64.ActiveCfg = Debug|Any CPU + {27BD1451-9A65-4578-8694-DDA354866DA3}.Debug|x64.Build.0 = Debug|Any CPU + {27BD1451-9A65-4578-8694-DDA354866DA3}.Debug|x86.ActiveCfg = Debug|Any CPU + {27BD1451-9A65-4578-8694-DDA354866DA3}.Debug|x86.Build.0 = Debug|Any CPU + {27BD1451-9A65-4578-8694-DDA354866DA3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {27BD1451-9A65-4578-8694-DDA354866DA3}.Release|Any CPU.Build.0 = Release|Any CPU + {27BD1451-9A65-4578-8694-DDA354866DA3}.Release|x64.ActiveCfg = Release|Any CPU + {27BD1451-9A65-4578-8694-DDA354866DA3}.Release|x64.Build.0 = Release|Any CPU + {27BD1451-9A65-4578-8694-DDA354866DA3}.Release|x86.ActiveCfg = Release|Any CPU + {27BD1451-9A65-4578-8694-DDA354866DA3}.Release|x86.Build.0 = Release|Any CPU + {AD4D5CF8-D33E-45A5-B30E-FB86133562EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AD4D5CF8-D33E-45A5-B30E-FB86133562EC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AD4D5CF8-D33E-45A5-B30E-FB86133562EC}.Debug|x64.ActiveCfg = Debug|Any CPU + {AD4D5CF8-D33E-45A5-B30E-FB86133562EC}.Debug|x64.Build.0 = Debug|Any CPU + {AD4D5CF8-D33E-45A5-B30E-FB86133562EC}.Debug|x86.ActiveCfg = Debug|Any CPU + {AD4D5CF8-D33E-45A5-B30E-FB86133562EC}.Debug|x86.Build.0 = Debug|Any CPU + {AD4D5CF8-D33E-45A5-B30E-FB86133562EC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AD4D5CF8-D33E-45A5-B30E-FB86133562EC}.Release|Any CPU.Build.0 = Release|Any CPU + {AD4D5CF8-D33E-45A5-B30E-FB86133562EC}.Release|x64.ActiveCfg = Release|Any CPU + {AD4D5CF8-D33E-45A5-B30E-FB86133562EC}.Release|x64.Build.0 = Release|Any CPU + {AD4D5CF8-D33E-45A5-B30E-FB86133562EC}.Release|x86.ActiveCfg = Release|Any CPU + {AD4D5CF8-D33E-45A5-B30E-FB86133562EC}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/tasks/ostrovskaya-sf/lab_2/pic1.png b/tasks/ostrovskaya-sf/lab_2/pic1.png new file mode 100644 index 0000000000000000000000000000000000000000..ee226aaa23d664d93ddb3f7b724e050adbd9eab2 GIT binary patch literal 3275 zcmZvfc{~(a8^?z%*@Z0Oaw7&)V~{CihQ`=whLU0k*_rH1S)v%rq%^i{H5nRf8VXrs zXe8Shin^spMr9rQ@=ou)@8`a~_xR=ns4J0m#$~Eoil4`hX-pR9qKf7?Wv|XyMR_QMG(tKlQBrSyG& zKMM`3EU%YZqb&a6kk30~{q_av2TB|A`%|`wp@q$z4yr`3okN4_9*Om>*ssb@1(O7B;pG6xlE!DG!>_W1 zF4wGwOS)yUOnMlZ%^QTx%&NZO*OySW@fBSW(`?8#g*gwZwI!Vtxz!2WVKQvvb&O zp#(EY!QJ#p&(=@Pz5^6bLGG{s=GNSbCHR|NSS=9J0XiQfZ!t5D`xb2@!15yyKxKxv zEs5kNKBS^UAoyO6_i@)=LYyGTpZ1=9mV@@=(g__4)GG{;;!9#y6-! zoF<)HB*k8FLaPm{If{syJ|T-3qR?#PSQxz>i+2xuL&}>*hgg+Vr<`3gq7SAI96)aK zhSY&alKxn64F}g6*X@r-kQ%Ju}oEoECt0~R*MCmkw2KE?eF+3lx>n6GJ@w6;m zIaNpu20t3)@~mnPugqFZY}$YLYP##C{1eINCFm-1?%m&5_-7NTZu_VFez4f=^$@Yb9bnC&&B93RG;pkx|=U?b^0+@(8CU+sT}$6(VLpozzBN z-|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MK###2@uW>3=>x)PY5bJS$AaoVm^Dl!08#1;P-=c2Pn{TbPGR*l z!SR7<+D7XAG(@e!v*j+Idnl{8s3!a4N^d_O?yc0?7^$H0E@YB(@=g^_|@0l1;S{;CUS_yNZVb&ys$6lzknw6 zlME}cf7P1!12ch79Eu}3h+iA&XwIC&$cG2;)QGCWoF>~m(z4p@0xM+8>09he?P$L85kcc#N_@tA&oZullp#)I4J;I|gz)N#n1z)6V?XdkrG%+^}5;v;m;~cCbZxK*(+qw-E9*^YGN|h~;5dGQDH$KA&v+OW% zNLM_l-BE2v=(-CNw!$ksF2yR_*-Q4FPjStlm!BhgH0%b!5P7lDjk(b4q{QPQ)xB^( zwbUr)%=bO(Ktb@qyGem5)xErUJ|8m?Sd^*}D8ZkkNhBwds`M$jU1aELsy= zi6nFha?wxMpustxFE+R9Og*t@2$<9wxnR2TUBkEf6AW@uZm8|rsesc5{MDhkca}zu z0TX?QIevsYZV85&yfy|nvD;>o04>oYWoC1?xx{{@5?qxC=+pa!W8PB-S#kT-mtR47 T_GPm_AOLd{8$`9SYr?+(1X=A| literal 0 HcmV?d00001 diff --git a/tasks/ostrovskaya-sf/lab_2/pic2.png b/tasks/ostrovskaya-sf/lab_2/pic2.png new file mode 100644 index 0000000000000000000000000000000000000000..d056f790b9faf856437c063d1664e304f8256e3f GIT binary patch literal 8563 zcmd6NcUV$?{4bUbEz6ObnVFL`M>ez+CC!nO)XE%5!*b8ma6y@sBPAtQ8kAOKLsE0) zpb}IxGe_>k&_qQgL~t?gvG4b}zvubg`}}^-eeV6^{sD)>IfpaepZ9BhNIBzVBO$&= z90USM*q*j@0f9EafX^9QHv{hnW@pa>3y~WxHWr}LZ+oYK6;WSvM{^LU484tac@wZM z7IxbG1_&fMv;GoE>=DlcfmF8ITAH6lc+Wj)kNR2DZ7q~6bprQ<`}H~_p671}+pJ5- z7;96zyPxp;+5CW1^_dt895;n4HX>U2%P1lVlo(5 z+}a_zesv(F{n#;M9*58SLuJM)fIy!l?jR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H-*Per1!5M1>J#OvHtUBDY1Gn>WU36`#1-`Us;dNLd|^n_S5OG#9D%umUw_*Fi?dX`mNEc zyLYHuo%OJHwZE;7h!!sI`<2g&gF$~8(qNWF_T{#B+wYX|oA{<#ZOvAMCZ082A2=!=MB~aIVsxHf42`)<& zv@Kac0H2-tlk6JI?r*y@_9~?Dw#em6LCCd;$Fq5cffe}$NXNLl6WT^gk83g;{m{?L z#eTR35>sw3pMLPJA-I=Uk%X9}%~7f}n$>jQa0uB;$uh1`BUJZF9a%86T2giqaw0B( zRYI=5SAtu0`JezA+k9eOExr%RdowX+v^Xg-7_vA=Q7117*}=dh)+NJ`wdGb+6;~tW zOvth+jS^oqm$G)uTth()c88Vemr`ooL5!@o7hIQ#y8Nwo6-LJ?;-aB}Y@2ejptmvX zUCdtX@z7!YugnjqHTOquE!7qSJFkn-=Q_mv00LZ3J~~`gf@+XQ9`!puL9o-O2ah*h zZ+sbiY9}9GQ0-vouU!7t4Wi%>k(Cf&ur=X9D!zeMVR6EplF8BkDq*!ZkD+NcD8Lx2 zh;5nJolOheI)3@khUO9dcKf8N8*JZRq~bOWvv*wg`s0{6`)B7LQ}3-)(7Vjl(Fy?o z!?&MdfS?w1iz@N&oRE + + + Exe + net5.0 + worker_1 + + + diff --git a/tasks/ostrovskaya-sf/lab_2/worker-2/Dockerfile b/tasks/ostrovskaya-sf/lab_2/worker-2/Dockerfile new file mode 100644 index 0000000..49ab49f --- /dev/null +++ b/tasks/ostrovskaya-sf/lab_2/worker-2/Dockerfile @@ -0,0 +1,17 @@ +#задаем базовый образ на .net 5.0 +FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build-env +#задаем рабочую директорию +WORKDIR /app + +#в каталог копируем файлы и папки в контейнер +COPY . /app +#создаем образы и устанавливаем данные пакеты в контейнер +RUN dotnet restore +COPY . . +RUN dotnet publish -c Release -o /publish + +FROM mcr.microsoft.com/dotnet/aspnet:5.0 +WORKDIR /publish +COPY --from=build-env /publish . +#вызываем приложение во время выполнения контейнера +ENTRYPOINT ["dotnet", "worker-2.dll"] \ No newline at end of file diff --git a/tasks/ostrovskaya-sf/lab_2/worker-2/Program.cs b/tasks/ostrovskaya-sf/lab_2/worker-2/Program.cs new file mode 100644 index 0000000..e11b7c1 --- /dev/null +++ b/tasks/ostrovskaya-sf/lab_2/worker-2/Program.cs @@ -0,0 +1,34 @@ +using System; +using System.IO; + +string[] lines = File.ReadAllLines("../var/data/data.txt"); + +int firstNumber = 0; +int lastNumber = 0; + +foreach (string line in lines) +{ + if (int.TryParse(line, out int number)) + { + firstNumber = number; + break; + } +} + +for (int i = lines.Length - 1; i >= 0; i--) +{ + if (int.TryParse(lines[i], out int number)) + { + lastNumber = number; + break; + } +} + +int multiplication = firstNumber * lastNumber; + +using (StreamWriter writer = new StreamWriter("../var/result/result.txt")) +{ + writer.WriteLine(multiplication); +} + +Console.WriteLine("Произведение успешно записано в файл! Результат: " + multiplication); \ No newline at end of file diff --git a/tasks/ostrovskaya-sf/lab_2/worker-2/worker-2.csproj b/tasks/ostrovskaya-sf/lab_2/worker-2/worker-2.csproj new file mode 100644 index 0000000..fb2480c --- /dev/null +++ b/tasks/ostrovskaya-sf/lab_2/worker-2/worker-2.csproj @@ -0,0 +1,9 @@ + + + + Exe + net5.0 + worker_2 + + + From 685fd6ab9bb4678af304a72d62fd6f562bff28d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D0=BE=D1=84=D1=8C=D1=8F=20=D0=9E=D1=81=D1=82=D1=80?= =?UTF-8?q?=D0=BE=D0=B2=D1=81=D0=BA=D0=B0=D1=8F?= Date: Tue, 17 Oct 2023 10:35:30 +0400 Subject: [PATCH 2/2] fix --- .config/dotnet-tools.json | 5 ---- .../ostrovskaya-sf/lab_2/worker-1/Program.cs | 4 +-- .../ostrovskaya-sf/lab_2/worker-2/Program.cs | 28 +++---------------- 3 files changed, 6 insertions(+), 31 deletions(-) delete mode 100644 .config/dotnet-tools.json diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json deleted file mode 100644 index b0e38ab..0000000 --- a/.config/dotnet-tools.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "version": 1, - "isRoot": true, - "tools": {} -} \ No newline at end of file diff --git a/tasks/ostrovskaya-sf/lab_2/worker-1/Program.cs b/tasks/ostrovskaya-sf/lab_2/worker-1/Program.cs index 732f173..716a34c 100644 --- a/tasks/ostrovskaya-sf/lab_2/worker-1/Program.cs +++ b/tasks/ostrovskaya-sf/lab_2/worker-1/Program.cs @@ -2,11 +2,11 @@ using System.IO; using System.Net.Http; -var dir = new DirectoryInfo("../var/data"); +var dir = new DirectoryInfo("/var/data"); var files = dir.GetFiles(); -string resultFilePath = "../var/result/data.txt"; +string resultFilePath = "/var/result/data.txt"; try { int[] mass = new int[files.Length]; diff --git a/tasks/ostrovskaya-sf/lab_2/worker-2/Program.cs b/tasks/ostrovskaya-sf/lab_2/worker-2/Program.cs index e11b7c1..f78f1ec 100644 --- a/tasks/ostrovskaya-sf/lab_2/worker-2/Program.cs +++ b/tasks/ostrovskaya-sf/lab_2/worker-2/Program.cs @@ -1,32 +1,12 @@ using System; using System.IO; +using System.Linq; -string[] lines = File.ReadAllLines("../var/data/data.txt"); +string[] lines = File.ReadAllLines("/var/data/data.txt"); -int firstNumber = 0; -int lastNumber = 0; +int multiplication = Convert.ToInt32(lines.First()) * Convert.ToInt32(lines.Last()); -foreach (string line in lines) -{ - if (int.TryParse(line, out int number)) - { - firstNumber = number; - break; - } -} - -for (int i = lines.Length - 1; i >= 0; i--) -{ - if (int.TryParse(lines[i], out int number)) - { - lastNumber = number; - break; - } -} - -int multiplication = firstNumber * lastNumber; - -using (StreamWriter writer = new StreamWriter("../var/result/result.txt")) +using (StreamWriter writer = new StreamWriter("/var/result/result.txt")) { writer.WriteLine(multiplication); }